You are on page 1of 807

Engineer On a Disk

Overview: This note set is part of a larger collection of materials available at http://claymore.engi-
neer.gvsu.edu. You are welcome to use the material under the license provided at http://clay-
more.engineer.gvsu.edu/eod/global/copyrght.html. As always any feedback you can provide
will be welcomed.

Copyright © 1993-2001, Hugh Jack

email: jackh@gvsu.edu
phone: (616) 771-6755
fax: (616) 336-7215

Copyright © 1993-2001, Hugh Jack


page 2

1. TABLE OF CONTENTS
TABLE OF CONTENTS.......................................................................................................... 2
OVERVIEW ............................................................................................................................. 8
PROCESS CONTROL ............................................................................................................. 9
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9
CONTROL SYSTEM CHARACTERISTICS - - - - - - - - - - - - - - - - - - - - - - - - - 10
CONTROLLER TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11
PROCESS DIAGRAMS AND SYMBOLS - - - - - - - - - - - - - - - - - - - - - - - - - - - 11
PRACTICE QUESTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 11
DISCRETE CONTROLLER DESIGN .................................................................................. 12
POSITIONING CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12
TRACKING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22
DISTURBANCE RESISTANT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25
MULTI-CONTROLLER SYSTEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 28
SAMPLE TIME - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 34
SUMMARY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 35
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 36
DISCRETE SYSTEMS .......................................................................................................... 38
DISCRETE SYSTEM MODELLING WITH EQUATIONS - - - - - - - - - - - - - - - 38
DISCRETE CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 48
BLOCK DIAGRAMS AND TRANSFER FUNCTIONS - - - - - - - - - - - - - - - - - - 56
SAMPLING FUNCTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 68
SYSTEM RESPONSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 72
STEADY STATE ERROR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 76
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 78
PETRI NETS .......................................................................................................................... 81
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 81
IMPLEMENTATION FOR A PLC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 87
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 91
CONTINUOUS CONTROL SYSTEMS................................................................................ 92
CONTROL SYSTEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 92
ROOT-LOCUS PLOTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 113
DESIGN OF CONTINUOUS CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - 121
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 121
FUZZY LOGIC .................................................................................................................... 126
COMMERCIAL CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 130
REFERENCES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 130
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 131
MECHATRONICS CIRCUITS............................................................................................ 132
POWER SWITCHING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 132
USER INPUT/OUTPUT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 132
HARDWARE BASED CONTROLLERS............................................................................ 134
CIRCUITS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 134
FLUIDICS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 134
PNEUMATICS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 134
page 3

PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 134


EMBEDDED CONTROLLERS........................................................................................... 135
TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 135
CONTROLLER DESIGN EXAMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 135
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 135
DISCRETE SENSORS......................................................................................................... 136
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 136
SENSOR WIRING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 136
CONTACT DETECTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 143
PROXIMITY DETECTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 143
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 156
CONTINUOUS SENSORS .................................................................................................. 159
INPUT ISSUES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 159
SENSOR TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 163
ANGULAR POSITION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166
LINEAR POSITION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 170
VELOCITY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 173
ACCELERATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 174
FORCE/MOMENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 176
FLOW RATE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 181
TEMPERATURE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 182
SOUND - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 185
LIGHT INTENSITY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 186
PRESSURE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 187
REFERENCES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 188
ACTUATORS ...................................................................................................................... 189
ACTUATOR TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189
DISCRETE ACTUATORS .................................................................................................. 189
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 189
TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 190
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195
CONTINUOUS ACTUATORS ........................................................................................... 196
ACTUATOR CONTROL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 196
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 202
PROGRAMMABLE LOGIC CONTROLLERS.................................................................. 203
BASIC PLCs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 203
A SIMPLE EXAMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 212
PLC CONNECTION ............................................................................................................ 215
SWITCHED INPUTS AND OUTPUTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - 215
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 226
PLC OPERATION ............................................................................................................... 232
PLC ORGANIZATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 232
PLC STATUS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 233
MEMORY TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 234
page 4

SOFTWARE BASED PLCS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 234


PROGRAMMING STANDARDS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 234
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 236
SWITCHING LOGIC........................................................................................................... 238
BOOLEAN ALGEBRA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 238
DISCRETE LOGIC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 240
SIMPLIFYING BOOLEAN EQUATIONS - - - - - - - - - - - - - - - - - - - - - - - - - - 247
ADDITIONAL TOPICS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 250
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 253
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 254
NUMBERING ...................................................................................................................... 271
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 271
DATA VALUES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 272
DATA CHARACTERIZATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 281
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 283
EVENT BASED LOGIC ...................................................................................................... 286
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 286
TIMERS, COUNTERS, FLIP-FLOPS, LATCHES - - - - - - - - - - - - - - - - - - - - - 286
PROGRAM DESIGN METHODS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 303
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 306
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 314
SEQUENTIAL LOGIC DESIGN......................................................................................... 321
SCRIPTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 321
FLOW CHARTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 325
STATE BASED MODELLING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 335
PARALLEL PROCESS FLOWCHARTS - - - - - - - - - - - - - - - - - - - - - - - - - - - 360
SEQUENTIAL LOGIC CIRCUITS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 370
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 372
ADVANCED LADDER LOGIC FUNCTIONS .................................................................. 406
ADDRESSING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406
INSTRUCTION TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 412
DESIGN TECHNIQUES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 440
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 442
FUNCTION REFERENCE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 445
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 471
PLC PROGRAMMING........................................................................................................ 478
PROGRAMMING STANDARDS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 480
STRUCTURED TEXT PROGRAMMING.......................................................................... 481
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 481
THE LANGUAGE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 481
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 494
INSTRUCTION LIST PROGRAMMING ........................................................................... 495
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 495
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 498
FUNCTION BLOCK PROGRAMMING ............................................................................ 500
page 5

INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 500
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 501
ANALOG INPUTS AND OUTPUTS .................................................................................. 503
ANALOG INPUTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 503
ANALOG OUTPUTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 511
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 514
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 515
CONTINUOUS CONTROL................................................................................................. 521
CONTROLLING CONTINUOUS SYSTEMS - - - - - - - - - - - - - - - - - - - - - - - - 522
CONTROLLING DISCRETE SYSTEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - 523
CONTROL SYSTEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 523
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 527
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 527
PLC DATA COMMUNICATION ....................................................................................... 528
COMPUTER COMMUNICATIONS CATEGORIES - - - - - - - - - - - - - - - - - - - 528
THE HISTORY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 529
WITH PLCs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 529
SERIAL COMMUNICATIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 530
PARALLEL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 541
NETWORKS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 541
BUS TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 554
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 562
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 563
HUMAN MACHINE INTERFACES (HMI) ....................................................................... 566
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 566
HMI/MMI DESIGN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 567
DESIGN CASES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 567
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 568
DESIGNING LARGE SYSTEMS ....................................................................................... 569
PROGRAMMING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 569
DOCUMENTATION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 570
PLC PROGRAM DESIGN FORMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 571
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 578
IMPLEMENTATION........................................................................................................... 579
ELECTRICAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 579
SAFETY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 591
PROCESS MODELLING .................................................................................................... 594
REFERENCES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 597
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 597
SELECTING A PLC ............................................................................................................ 599
SPECIAL I/O MODULES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 603
PLC PROGRAMMING LANGUAGES - - - - - - - - - - - - - - - - - - - - - - - - - - - - 607
ISSUES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 607
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 607
PLC REFERENCES ............................................................................................................. 609
SUPPLIERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 609
page 6

PROFESSIONAL INTEREST GROUPS - - - - - - - - - - - - - - - - - - - - - - - - - - - 610


PLC/DISCRETE CONTROL REFERENCES - - - - - - - - - - - - - - - - - - - - - - - - 610
USING THE OMRON DEMO PACKAGE ......................................................................... 614
OVERVIEW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 614
REFERENCE GUIDE FOR OMRON PLC DEMO SOFTWARE - - - - - - - - - - - 618
INDUSTRIAL ROBOTICS.................................................................................................. 619
INTRODUCTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 619
ROBOT TYPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 632
ROBOT APPLICATIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 663
END OF ARM TOOLING (EOAT) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 666
ADVANCED TOPICS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 675
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 676
ROBOTIC PATH PLANNING METHODS........................................................................ 690
INTRODUCTION: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 690
GENERAL REQUIREMENTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 696
SETUP EVALUATION CRITERIA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 704
METHOD EVALUATION CRITERIA - - - - - - - - - - - - - - - - - - - - - - - - - - - - 709
IMPLEMENTATION EVALUATION CRITERIA - - - - - - - - - - - - - - - - - - - - 716
OTHER AREAS OF INTEREST - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 719
COMPARISONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 720
CONCLUSIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 722
APPENDIX A - OPTIMIZATION TECHNIQUES - - - - - - - - - - - - - - - - - - - - 722
APPENDIX B - SPATIAL PLANNING - - - - - - - - - - - - - - - - - - - - - - - - - - - 725
APPENDIX C - TRANSFORMED SPACE - - - - - - - - - - - - - - - - - - - - - - - - - 731
APPENDIX D - FIELD METHODS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 738
APPENDIX E - NEW AND ADVANCED TOPICS - - - - - - - - - - - - - - - - - - - 740
REFERENCES: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 741
ROBOTIC MECHANISMS ................................................................................................. 746
KINEMATICS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 746
MECHANISMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 749
ACTUATORS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 750
PATH PLANNING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 752
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 758
MOTION PLANNING AND TRAJECTORY CONTROL ................................................. 763
TRAJECTORY CONTROL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 763
PATH PLANNING - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 767
MOTION CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 771
SPECIAL ISSUES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 774
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 776
MICROBOT OVERVIEW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 778
CRS PLUS ROBOT OVERVIEW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 778
BASIC DEMONSTRATION STEPS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 779
CNC MACHINES ................................................................................................................ 781
MACHINE AXES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 781
NUMERICAL CONTROL (NC) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 781
EXAMPLES OF EQUIPMENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 785
page 7

PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 788


CNC PROGRAMMING....................................................................................................... 789
G-CODES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790
APT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 798
PROPRIETARY NC CODES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801
GRAPHICAL PART PROGRAMMING - - - - - - - - - - - - - - - - - - - - - - - - - - - - 802
NC CUTTER PATHS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 803
NC CONTROLLERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805
PRACTICE PROBLEMS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805
page 8

2. OVERVIEW

Mechatronics deals with the long ignored union of machanical and electrical systems.
page 9

3. PROCESS CONTROL

• To put it simply - we figure out how the process behaves naturally, we determine how we want it
to behave, and we insert a controller to make it do what we want.

3.1 INTRODUCTION

• CONTROL - Using artificial means to manipulate the world - with a particular goal.

CONTROL

CONTINUOUS DISCRETE

LINEAR NON_LINEAR CONDITIONAL SEQUENTIAL


EVENT BASED
e.g. MRAC TEMPORAL
e.g. PID BOOLEAN
e.g. FUZZY LOGIC e.g. COUNTERS
EXPERT SYSTEMS e.g. TIMERS

• Continuous - the values to be controlled change smoothly. e.g. the speed of a car

• Discrete - The value to be controlled are easily described as on-off. e.g. the car motor is on-off
(like basic pneumatics). NOTE: all systems are continuous (Except for Heisenberg’s electrons)
but they can be treated as discrete for simplicity.

• Linear - Can be described with a simple differential equation (not a very accurate explanation).
e.g. a car can be driving around a track and can pass same the same spot at a constant
velocity. But, the longer the car runs, the mass decreases, and it travels faster, but
requires less gas, .......... etc. Basically, the math gets tougher, and the problem
becomes non-linear.
- This is the preferred starting point for simplicity, and a common approximation for real
world problems.

• Non-Linear - Not Linear. This is how the world works, but is very complicated. Especially when
trying to do mathematical approximations. (Note: if the coefficients in a differential equation
change it is non-linear)
page 10

• Temporal/sequential - the controller must not just keep track of things that changes, but it must
know the time, or how long since something happened.

• e.g.
non-linear - as rocket approaches sun, gravity increases, so control must change.
linear - We are driving the perfect car with no friction, with no drag, and can predict how it
will work perfectly.
discrete - “When I do this, that always happens!” For example, when the power is turned
on, the press closes!

How to tell the difference? An elevator is the perfect example.

Discrete
1. The elevator must move towards a floor when a button is pushed.
2. The elevator must open a door when it is at a floor.
3. It must have the door closed before it moves.
etc.
Linear (our approximation commonly used in industry) NOTE: each floor will have a cer-
tain motor position, and we know what that position is.
1. If the desired position changes to a new value, accelerate quickly
towards the new position.
2. As the elevator approaches the correct position, slow down.
Non-linear (not yet common in industry) e.g. Fuzzy logic, Neural Networks, Adaptive
Control
1 Accelerate slowly to start.
2. Decelerate as you approach the final position.
3. Allow faster motion while moving.
4. Compensate for cable stretch, and changing spring constant, etc.

3.2 CONTROL SYSTEM CHARACTERISTICS

• Control systems are present in most systems we see. Example - elevator height.

• Some systems are naturally unstable and tend to self destruct. Example - balanced broom.

• Other systems are self regulating, and tend to some stable state - these are good candidates for
open loop control. Example - city water tank

• Other systems need some sort of regulation mechanisms added, these are called closed loop sys-
tems. Example - car cruise control
page 11

• If a system is simple we will say that it is linear. Example - perfect elevator

• A system can be subject to complicating factors that make it difficult/impossible to model math-
ematically. Example - elevator in tall building with stretchy cable

• If a system has switched states it can be described as discrete. Example - buttons to call elevator,
open/close doors

• Temporal/sequential systems can change over time, this requires sequential control. Example -
washing machine

3.3 CONTROLLER TYPES

- PLCs
- embedded controls
- PCs
- hardwired

3.4 PROCESS DIAGRAMS AND SYMBOLS

3.5 PRACTICE QUESTIONS

1. Consider a heater in your house, how can different forms of control be applied to this problem?

2. Why is discrete control so popular when continuous control allows more precision?
page 12

4. DISCRETE CONTROLLER DESIGN

• In controller design we try to meet some objective. Typical objectives include,


- positioning - for moving from position to position, where the setpoint is changed sud-
denly
deadbeat control
first order
- tracking - for following paths where setpoints are constantly changing
first order
- disturbance resistant - unexpected variations can be compensated for
step response
- multi-stage - for complex systems that need small errors
feed forward disturbance - can reduce effects of disturbances
feed forward command - to follow complex motions
cascade - a controller that examines intermediate steps of a process

• typical constraints to be developed are,


- stability - does not diverge over time
- stability - sampling period is short enough (no-aliasing)
- realizable - does not refer to future values

4.1 POSITIONING CONTROLLERS

• In these systems we will focus on how the output relates to the input.

• These techniques work best with simple systems that require a jump from one setpoint to
another.

• The general procedure to design a controller is,


1. Model the process (i.e., find Gp)
2. Determine the control objective (i.e. select the desired system response Gdr)
3. Substitute these into the equation below and solve for the controller transfer function,

cn G c ( B )G p ( B )
G dr ( B ) = ----- = ----------------------------------------
rn 1 + G c ( B )G p ( B )

c Gdr ( B )
G c ( B ) = ----n- =  ---------------  --------------------------
1
rn  G p ( B )  1 – G dr ( B )

4. Check the equation for practicality and stability


5. Develop the control equation for the computer
page 13

6. Write the computer program

• Try to derive the expression given above,

c G c ( B )G p ( B )
G dr ( B ) = ----n- = ----------------------------------------
rn 1 + G c ( B )G p ( B )

4.1.1 Dead Beat Control

• It is possible (for a first order process) to match the output function to the input function in one
step.

• The desired function is,

cn = rn – 1 desired posn
cn
G dr ( B ) = ----- = B T
rn

actual posn

• Given the process model below, design a deadbeat controller,


page 14

B
G p ( B ) = --------------------
1 – 0.5B

• Trying to eliminate the error in one step can require an extremely high (power) gain. When this
gain is excessive we may use a less powerful controller.

4.1.2 Programming Examples

• The following programs are examples of methods for programming using a few common lan-
guages.

• These examples are for the Computer Boards DAS08-AOM board (The boards we used in the
lab with Labview).

• Please note that these programs have not been debugged.


page 15

4.1.2.1 - BASIC

• A simple example of the deadbeat controller is given below. This can be converted to many of
the ‘modern’ version of basic that have appeared. Comments have been added to help clarify
the operation

10 REM a control loop for the deadbeat controller example for 12 bit input and output
15 REM Written by H.Jack, July 17, 1997 - Not debugged
20 BASE = 330H; REM the base address for the card
20 T = 0.1; REM control system time step
40 M_LAST = 0; REM the current output is zero
50 E_LAST = 0; REM the current error
60 INPUT “ENTER SETPOINT [0 - 4095]” , R; REM get a setpoint
70 DO ; REM start the control loop
80 OUT BASE+2, 0; REM start the a to d conversion
90 WAIT T; REM an operating system specific timing function
100 C_HIGH = INP BASE+0; REM read current position most significant 8 bits
110 C_LOW = INP BASE+1; REM read current position least significant 4 bits
120 C_NOW = C_LOW/16 + C_HIGH*16
130 E_NOW = R - C_NOW; REM calculate the error
140 M_NOW = M_LAST + E_NOW - 0.5*E_LAST; REM the controller equation
150 IF (M_NOW < 0) THEN M_NOW = 0; REM prevent out of range case
160 IF (M_NOW > 4095) THEN M_NOW = 4095; REM prevent out of range case
170 M_HIGH = INT(M_NOW/256) ; REM find the 4 high bits of the 12 bit word
180 M_LOW = M_NOW - 256*M_HIGH; REM isolate the low 8 bits
190 OUT BASE+4, (M_LOW); REM set 8 low bits
200 OUT BASE+5, (M_HIGH); REM set 4 high bits
210 M_LAST = M_NOW; E_LAST = E_NOW; REM current values become last values
220 LOOP WHILE(ABS(E) < 0.001); REM continue looping until the error is small

4.1.2.2 - C

• The example program below should implement the deadbeat controller example given in this
section,
page 16

/* A deadbeat controller for a Computer Boards DAS08-AOM card using 16 bit IO */


/* Written by H.Jack, July 17, 1997 - Not debugged */
#include <stdio>
#include <conio.h>

main(){
int base = 0x330, /* Base address for card */
r, c_now, /* Set up variables for equations */
e_now, e_last=0, /* error values */
m_now, m_last=0; /* control values */
double T = 0.1; /* set the system time step */

printf(“Enter the Setpoint [0 - 4095]”);


scanf(“%d”, r); /* Input a setpoint */

while(abs(e_last) < 1){ /* loop until the error is small */


outp(base+2, 0); /* start the a to d conversion process */
sleep(T); /* an operating system specific timing function */
c_now = inp(base+0)/16 + inp(base+1)*16; /*calculate the current value */
e_now = r - c_now; /* calculate current error */
m_now = m_last + e_now - 0.5 * e_last; /* the control equation */
if (m_now < 0) m_now = 0; /* keep the output in 0-4095 range */
if (m_now > 4095) m_now = 4095;
outp(base+4, m_now & 255); /* output 8 LSB */
outp(base+5, m_now>>8); /* output 4 MSB */
m_last = m_now; e_last = e_now; /* make current values last */
}
}

4.1.2.3 - Pascal

• The example program below should implement the deadbeat controller example given in this
section,
page 17

{ A deadbeat controller for a Computer Boards DAS08-AOM card using 16 bit IO }


{ Written by H.Jack, July 17, 1997 - Not debugged }

program deadbeat(input, output);

var
base = 0x330, { Base address for card }
r, c_now, { Set up variables for equations }
e_now, e_last=0, { error values }
m_now, m_last=0: integer; { control values }

T = 0.1: float; { set the system time step }


begin
writeln(‘Enter the Setpoint [0 - 4095]’);
readln(r); { Input a setpoint }

while (abs(e_last) < 1) do{ loop until the error is small }


begin
outp(base+2, 0); { start the a to d conversion process }---------
sleep(T); { an operating system specific timing function }---------
c_now := inp(base+0)/16 + inp(base+1)*16; {calculate the current value }-
---
e_now := r - c_now; { calculate current error }
m_now := m_last + e_now - 0.5 * e_last; { the control equation }
if (m_now < 0) then
m_now := 0; { keep the output in 0-4095 range }
if (m_now > 4095) then
m_now := 4095;
outp(base+4, m_now & 255); { output 8 LSB } -------
outp(base+5, m_now>>8); { output 4 MSB }---------
m_last := m_now; e_last := e_now; { make current values last }
end;
end.

4.1.2.4 - 6811 Assembler


page 18

• The example program below should implement the deadbeat controller example given in this
section for a 6811 single chip microcontroller.

• As an exercise, implement the controller on a Basic Stamp chip.


page 19

(note: this program will be similar to all others)

4.1.3 First Order Response

• The deadbeat controller can call for extremely high gains, but this requires a high level of power
not commonly found in engineered systems.

• When we want to slow down the system response so that it occurs over a number of controller
steps, we can replace the deadbeat (one time step) function with a gradual first order reduction
(exponential decay) over a number of time steps.

• This gradual response will use a time constant to produce the rate of response (recall that the dif-
ference between input and output is reduced 63% for each duration of the time constant).
page 20

• The general form of this relationship is seen below,

First we relate the output ‘c’ to the input ‘r’ (Note the first order differential equation).

τ  ----- c + c = r
d
dt
Next, we convert this to a discrete equation using the methods (source - table) seen before,
T
 – ---
τ
B1 – e 
cn   (from transform table)
G dr = ----- = -------------------------
T
-
rn – ---
τ
1 – Be

actual

desired

• Consider the example for the deadbeat controller,


page 21

Assuming the process model given below, find the general form for the control equation,

First we write the process model,


B
G p ( B ) = --------------------
1 – 0.5B
Next, we use this and the desired response to find the controller equation,T
   – ---  
  B  1 – e τ  
    
  -------------------------- 
  – ---  
T
  1 – Be τ  
cn Gdr ( B ) 1 – 0.5B    
G c ( B ) = ----- =  ---------------  -------------------------- =  --------------------  -----------------------------------------
1
G p ( B ) 1 – G dr ( B )  – ---  
rn B T
 
  B  1 – e τ   

 1 –  -------------------------
  
-
  – ---  
T
  1 – Be τ  
  

T T T
 – ---
τ  – ---
τ  – ---
τ
 1 – e  ( 1 – 0.5B )  1 – e  – 0.5  1 – e  B
     
G c ( B ) = ---------------------------------------------------------------- = -------------------------------------------------------------------------
T T T T
 – ---  
τ
– --- 
τ
– ---
τ
– ---
τ
 1 – Be  –  B  1 – e   [1] + – e –1+e B
    
After some work.....this should lead the control difference equation,

mn = mn – 1 + …
page 22

• Assume the response time constant should be 1.0 seconds, and the sampling time is 0.2 seconds,
develop the final form of the controller.

τ = 1.0
T = 0.2

4.2 TRACKING

• In tracking controllers we assume that the setpoint will be moving. As a result we will focus on
a desired error function, instead of an overall transfer function.

• To do this we must first develop a function that relates the elements of the control loop, to the
desired error response,
page 23

First we look at the basic relationships for a feedback control system,

en = rn – cn cn = Gc Gp en

∴e n = r n – G c G p e n

∴e n ( 1 + G c G p ) = r n

Next we relate in the desired error response, and rearrange to separate the controller,
en 1
G de = ----- = -----------------------
rn 1 + Gc Gp
Note: The error is now treated as a position,
1
∴( 1 + G c G p ) = --------- and we want to control the error instead.
G de A small error will correspond to a small
1
∴G c G p = --------- – 1 difference between the changing input
G de and the resulting output.
1 1 – G de
∴G c = ------  ------------------
G p  G de 

• Specific controllers can be developed using the relationships used for the positioning controllers.

• As an example tracking control would be needed in your hand for curved letters, positioning
would result in block letters.

4.2.1 Minimum Error

• The method behind this controller is very similar to the deadbeat controller, we try to eliminate
the error in a single step,
page 24

The desired error function should have a finite value at only one point in time,
0 2 3 4
e n = S n ( … + 0B + ATB + 0B + 0B + 0B + … )
e n = S n ATB (A is the largest error value)

This has to be manipulated into the desired transfer function,


en S n ATB
G de = ----- = -----------------
rn rn
1 1 – G de 1 r n – ATBS n
G c = ------  ------------------ = ------  ----------------------------
G p  G de  G p  ATBS n 

At this point we would be given or assume an input forcing function, and use it also.

• Find a controller for the transfer function given below, assuming a ramped input with a sampling
time of 0.2 seconds. Use a maximum error of 0.02.

B
G p ( B ) = -------------------- r ( t ) = 0.2t
1 – 0.5B
page 25

4.3 DISTURBANCE RESISTANT

• In real systems we expect that certain events will occur that are not part of our system model.

• In this case we assume that the system control is happening as expected, and we add in a new
disturbance input.

• The block diagram below shows one of these systems, with a disturbance injected between the
controller and the process.

dn
+
cn
Gp

+
rn + en mn
Gc

If we neglect the effects of the setpoint, we can rearrange the loop as shown below,
mn
dn + ∆c n
Gp Note: we can do this
because the sys-
- tem is linear.

∆m n
Gc

• Notice that in the above form we are reducing the problem by finding differences (basically a
partial differential solution) which will be a good approximation when the disturbance is not
too fast or large.

• We can develop an equation for the controller, based on the desired system response to the dis-
turbance,
page 26

∆c n Gp
G dd = --------- = -----------------------
dn 1 + Gc Gp

G p – G dd
∴G c = ----------------------
G p G dd

• The closed form expression can be calculated by replacing the desired transfer function,

∆c
G dd = --------n-
dn
∆c n
G p – ---------
G p – G dd dn d n G p – ∆c n
G c = ---------------------- = ---------------------- = ---------------------------
G p Gdd ∆c n G p ∆c n
G p ---------
dn

• These systems are often called regulators, and can be used when a system is subject to unex-
pected noise. Examples of possible applications would include plumbing systems, electrical
power supplies, etc.

4.3.1 Disturbance Minimization

• We can use an approach similar to the deadbeat controller, but we still need to know the type of
disturbance expected to develop a controller.

0 1 2 3 4
∆c n = S n ( 0B + AB + 0B + 0B + 0B + … ) = ABS n

• Consider a case where the disturbance is a step function


page 27

Given the example transfer function and input disturbance,


B
G p ( B ) = --------------------
1 – 0.5B

d n = ( DB + DB + DB + DB + … )S n =  ------------ S n
0 1 2 3 1
1–B
Next we assume
0 1 2 3 4
∆c n = S n ( 0B + 5B + 0B + 0B + 0B + … ) = 5BSn
And these are used to calculate the controller equation
 -----------
1 -  -------------------
S
B -
– 5BS n
d n G p – ∆c n  1 – B  1 – 0.5B n
1 – 5 ( 1 – 0.5B ) ( 1 – B )
G c = --------------------------- = --------------------------------------------------------------------- = -------------------------------------------------------
G p ∆c n  -------------------
B - 5B ( 1 – B )
5BS
 1 – 0.5B n

2
1 – 5 ( 1 – 0.5B ) ( 1 – B ) 1 – 5 + 7.5B – 2.5B
G c = ------------------------------------------------------- = -------------------------------------------------
5B ( 1 – B ) 5B – 5B
2

Now we put this in discrete equation form,

mn 2
------ = 1-------------------------------------------------
– 5 + 7.5B – 2.5B
en 2
5B – 5B
∴5m n – 1 – 5m n – 2 = – 4e n + 7.5e n – 1 – 2.5e n – 2

∴5m n – 1 = 5m n – 2 – 4e n + 7.5e n – 1 – 2.5e n – 2

∴m n = m n – 1 – 0.8e n + 1 + 1.5e n – 0.5e n – 1


Note: this controller has a reference to an ‘n+1’ error term. This term refers to an
error value that is in the future. So.... unless you have a time machine, this con-
troller is not REALIZABLE.

• We can examine the previous controller for stability as well,


page 28

First we get the characteristic equation from the denominator of the controller transfer function,
2
5B – 5B = 0
Next we find the roots of this equation,
B = 0
B = 1

In this case one root is less than 1, guaranteeing that the system will be unstable. The other
root with a value of one would lead to a system that is critically stable.

• If we have a first order system we only need to have a sample time that is shorter than the system
time constant.

4.4 MULTI-CONTROLLER SYSTEMS

• It can sometimes be helpful to have more than one controller in a system.

• In feedforward controllers we have one controller to deal with an input value, and a second to
control error.

• In cascade control we break the control into segments, that take advantage of readings within the
process.

4.4.1 Disturbance Feedforward

• When a system has a disturbance that can be measured we can add a controller that specifically
compensates.

• The figure below shows a feedforward disturbance controller,


page 29

dn
F(B)

Gf
fn + +
en mn m' n cn
+ Gc Gp
rn + +
-

In Computer

• In this case ‘F(B)’ is a function of how the disturbance actually effects the system. But ‘Gf’ is
the controller to compensate. First, we need a model of ‘F(B)’. Next the controller ‘Gf’ is,

Gf = –F ( B )

• The error controller is designed as if the disturbance is not present.

• This system is well suited to systems with large measurable disturbances. For example we could
measure cutting force, and adapt an axis controller on a CNC machine.

4.4.2 Command Feedforward

• By separating out error control, and process modeling functions we can make a system that is
more accurate, with reduced steady state error.

• This technique may be used when we have a process model, and the input will not be changing
suddenly (The feedback error controller will tend to overcompensate).

• We do this using a system of the form below,


page 30

Gf
fn

+
+ en mn m′ n cn
Gc Gp
rn
+
-

• The relevant transfer functions are,

The system transfer function is,


cn Gf Gc G p
G ( B ) = ----- =  1 + ------  -----------------------
rn Gc 1 + Gc Gp

The feedforward controller is best defined as, a perfect match when there is no error,
and the input and output are identical,

en = mn = 0 cn = rn

∴c n = r n G f G p
–1
∴G f = ( G p )

• The feedback error controller can be selected to reduce the errors. The typical design technique
is, to design for minimal error or disturbance.

• Develop the system transfer function (given before) for a command feed forward controller
page 31

cn
----- =
rn

4.4.3 Cascade

• By adding extra feedback loops we can add levels of robustness to a control system.

• In this case the control loops appear to be nested.

• Consider a cascade control system for disturbances,

dn

+
+ + + rn
Gc1 G c2 Gp
rn
- -
page 32

• Now consider a cascade controller for a multistage process, such as a sewage treatment plant
with sequential tanks with varying flow rates. Here the disturbance would be the sewage flow-
ing into the first tank. the two process blocks are the treatment tanks. The output is water
returned to rivers The controllers vary the flow rates by looking at parameters for both tanks.

dn

+
+ + + rn
G c1 G c2 Gp1 Gp2
rn
- -

Hf

• To do design/analysis for these controllers we do an analysis of the innermost feedback loop.


This then becomes a process, and we do design/analysis at the next higher loop.

• Select controllers for the system pictured below,


page 33

dn

+
+ + + 5B rn
Gc1 G c2 ------------
rn 1–B
- -

1. Design for Gc1 as if the disturbance and Gc2 are not present
2. Design for disturbance minimization with Gc2
page 34

4.5 SAMPLE TIME

• In deadbeat type controllers we do not typically see mentions of the sample period, but in most
practical systems we see a mention of the sample time ‘T’.

• We can use the system transfer function to calculate the acceptable range of controller time. In
all cases the lower sample period is 0, but for practical reasons we may want to make this
larger.

• A shorter sample time requires a faster computer, and steals cycle time from other processes.

• The general procedure is,


1. Find the characteristic equation of the overall system transfer function.
2. Determine the roots (symbolically) of the equation.
3. Select values of ‘T’ that ensure that all of the roots have a value of 1 or more.
4. Select a sample time that is less than the longest time.

• Consider the example below,

4TB – 2 -
G ( B ) = ----------------------------------
2 2
B + TB – 2T
Find the sample time T required for stability,
First, we find the characteristic equation, and solve for the roots, when the roots are

2 2
B + TB – 2T = 0
2 2
– ( T ) ± ( T ) – 4 ( 1 ) ( – 2T ) T T
B = -------------------------------------------------------------------- = --- ( – 1 ± 1 + 8 ) = --- ( – 1 ± 3 ) = 1
2(1 ) 2 2
T = 1, 0.5
Based on these results we can now determine the stable region.
page 35

4.6 SUMMARY

• The following is a map of techniques that show typical uses of the mathematical technique cov-
ered so far.

input functions error functions


from data

input function
table output
equation
real value table
system
B-shift partial fractions
or long division
input output final
function function value
differential
b-shift theory
equations
table steady state
algebra
transfer
function characteristic stability
difference equation analysis
equations b-shift
transfer
table function
calculations feedback
block
equation system transfer
estimated diagram
function
values
transfer
function transfer
function

realizability controller design pick sample


difference equation techniques time
equation

desired
behavior
page 36

4.7 PRACTICE PROBLEMS

1. a) We are developing a freight elevator control system. The first major task is developing a
height positioning controller. The elevator is moved to a new floor by issuing a step function
for the new floor height. The transfer function below relates the voltage supplied to the eleva-
tor motor to the height of the elevator. Develop a controller transfer function that has a first
order response, and draw a complete block diagram.

B+1
G p = --------------------
1 – 0.5B

b) Develop the discrete equation for the controller if the time constant for the first order response
is 5 seconds and the sampling time is 1 second.

2. c) Write a computer program (in the computer language of your choice) that implements the
controller in question 1. Assume the input and output values are set using the two functions
below.

INPUT() - This function will return the elevator height in feet (floating point)
OUTPUT(value) - This function will set the output voltage at ‘value’

3. Redraw the following system and add a feedforward controller. Develop the function used for
the feed forward controller.

+ B + 5- ( 10 – B )-
------------ -----------------------
2
B–1 B(1 – B)
_

B+2

4. The control system below will be used for positioning the height of an elevator.
page 37

rn + cn
Gc 1-----------
– B-
B
-

a) Find a controller transfer function that gives a first order response for a time step of T=1 and a
time constant of 3.

b) Develop the discrete equation and determine if the controller is realizable.

c) Develop a transfer function for the final system and determine if the system is stable.

ANS.
2
0.283B
a) G c = ---------------------------2-
1 – 2B + B
b) realizable
2
c) 0.283B
G = -------------------------- stable
1 – 0.717B

4. We want to design a control system to minimize the effects of disturbance. Given a step input of
magnitude 1, we are willing to accept a maximum error of 0.5 for one time step.

10B
G p = ------------
1–B

a) Find a controller transfer function.

b) Develop the discrete equation for the system and determine if the controller is realizable?

ANS. 2
10 – 0.5 ( 1 – B )
G c = ---------------------------------------
a) 5B ( 1 – B )
b) not realizable 9.5 1 0.5
m n = m n – 1 + ------- e n + 1 + --- e n – ------- e n – 1
5 5 5
page 38

5. DISCRETE SYSTEMS

• When dealing with computers we will sample data values from the real world. These sampled
values can then be used to estimate how a system will behave.

• The term ‘discrete’ refers to the use of single sampled values, instead of a continuous functions.
You will see that the difference is between weighted sums and integrals.

5.1 DISCRETE SYSTEM MODELLING WITH EQUATIONS

• We can write a differential equation, and then manipulate it to put in terms of time steps of
length ‘T’

sampled
values

T - Sample Period

• In review consider how we can approximate derivatives using two/three points on a line.
page 39

y(t)

yi + 1
yi
yi – 1

ti – 1 T T
ti ti + 1

ti
 y--------------------
i + y i – 1 T
∫ti – 1 i  2 - ( ti – ti – 1 ) = --2- ( yi + yi – 1 )
y ( t ) ≈

yi – yi – 1 yi + 1 – yi
y ( t i ) ≈  --------------------- =  --------------------- = --- ( y i – y i – 1 ) = --- ( y i + 1 – y i )
d- 1 1
----
dt  ti – ti – 1   ti + 1 – t i  T T

--1- ( y i + 1 – y i ) – --1- ( y i – y i – 1 )
 ----
d 2 T T y i + 1 + y i – 1 – 2y i
- y ( t i ) ≈ ----------------------------------------------------------------- = -----------------------------------------
 dt T 2
T

• Consider the example,

If we read the flow rate of oil in a pipeline once every hour for three hours. The read-
ings in order are 1003, 1007, 1010. What is the integral and first and second deriva-
tives for the values?
page 40

5.1.1 Getting a Discrete Equation

• First, consider the example of a simple differential equation,

 ----
d-
 dt y ( t ) = Kx ( t ) say d-
---- A = V
dt
We can solve the differential equation at time T, assuming that the slope is constant and known,
T 0 T T
y(T ) = ∫–∞ Kx ( t ) dt = ∫–∞ Kx ( t ) dt + ∫ Kx ( t ) dt = y 0 + ∫ Kx ( t ) dt
0 0
Now we can assume that the velocity ‘x(t)’ is constant,
for this particular differential
y ( T ) = y 0 + K ( x 0 )T equation we can assume ∆y = x 0 t

The equation above is developed for a time T after zero. We can manipulate it so that it
will be valid for any point in time,
ASIDE: The approximations above can
y ( T ) = y 0 + K ( x 0 )T be shown using a slope approxi-
mated with two points on a curve.
∴y n = y n – 1 + K ( x n – 1 )T

∴y n – y n – 1 = K ( x n – 1 )T

• We can continue the example and use this equation to simulate the system. Here the ‘x’ values
are given, and the first ‘y’ value is assumed to be 0. Assume T=0.5 and K=0.2.
page 41

i xi yi 0.2(xi)0.5

0 0 0 0
1 0 0 0
2 1 0.1 0.1
3 1 0.2 0.1
4 1 0.3 0.1
5 1 0.4 0.1
6 1 0.5 0.1
7 1 0.6 0.1
8 0 0.7 0
9 0 0.7 0
10 0 0.7 0
11 0 0.7 0
12 0 0.7 0
13 0 0.7 0
..... ..... ..... .....

• Find the discrete equation for the differential equation below. Then find values over time.

d- 1
---- v = ----- F
dt M

• We can expand this model by also including a ‘disturbance’. This can be used to model random
page 42

noise, or changes in system loading, found in all systems.

Go back to the original differential equation, and add a disturbance term ‘d’ that
appears for a single sample,

 ----
d-
 dt y ( t ) = Kx ( t ) + d ( t )
T T 0 T T
∴y ( T ) = ∫–∞ Kx ( t ) dt + ∫–∞ d ( t ) dt = ∫–∞ Kx ( t ) dt + ∫0 Kx ( t ) dt + ∫0 d ( t ) dt
y ( T ) = y 0 + K ( x 0 )T + d 0 T

assume
∴y n = y n – 1 + K ( x n – 1 )T + d n – 1 T
0
∫–∞ d ( t ) dt = 0
∴y n – y n – 1 = K ( x n – 1 )T + d n – 1 T

5.1.2 First Order System Example

• The water tank below has a small outlet, and left alone the fluid level in the tank will drop until
empty. There is a valve controlled flow of fluids into the tank to raise the height of the fluid.

qi

water flow in valve

water tank

A = Area of tank (i.e., fluid surface) qo


water flow out
page 43

• As long as the fluid levels in the tank are normal, the inlet and outlet flow rates are independent,
We can model them both with simple differential equations,

The water flow rate out of the tank is approximately a function of the hydrostatic
pressure caused by the water level in the tank,

qo = Ko h

The inlet valve can be (very roughly) approximated with a simple equation,

qi = Ki θ

We can now relate these components to find the fluid height in the tank,
d
∆V = q i – q o = A ----- h = K i θ – K o h
dt
d
∴A ----- h = K i θ – K o h
dt

d
∴A ----- h = K i θ – K o h
dt
The general form of solution for this differential equation for h is, (we will review later)
t
– -----------
 -----
A
- tK o
 K o Ki – -------- Ki
+  ------ θ = Ce +  ------ θ 0
A
h = Ce
Ko Ko
We can find the value of coefficient C by setting time to zero,

Ki Ki
h 0 = Ce +  ------ θ 0 ∴C = h 0 –  ------ θ 0
0
 K o  K o
The final form of this equation can be constructed, by separating out height and valve angle,

 K o  K o  K o
Ki – t ------
 A Ki  –t  -----
A 
-
 K i – t  ----- -
A Ki 
h =  h 0 –  ------ θ 0 e +  ------ θ 0 = h 0  e  + θ 0  –  ------ e +  ------ 
Ko
transient + steady state o
K    Ko Ko 

Put in terms of a time step, to prepare to make discrete,


 K o  K o
 –T  -----
A 
-
 K i –T  ----- -
A Ki 
hT = h0  e  + θ 0  –  ------ e +  ------ 
   Ko Ko 
Then to a discrete form, as a difference equation,
 K o  Ko
 –T  -----
A 
-
  K i  –T  -----
A
- Ki 
h n = hn – 1  e  + θn – 1  –  e
-----
- +  ------ 
   Ko Ko 
page 44

• This difference equation can then be used to predict fluid height. If we change the valve posi-
tion, this will also be reflected in the calculated values.

Use the parameters given to calculate the height of the water in the tank over time.

initial height =1 m
surface area = 2 m2
Ki = 1 liter/min/degree
Ko = 2 liter/min/m
valve angle = 20 degrees
T = 30 sec.

egr450.0.mcd

• Now try varying the input valve angle,


page 45

Using all of the conditions outlined before, find out what happens when the valve
angle is changed to 10 degrees after 10 seconds.

5.1.3 Second Order System Example

• Consider the second order example below,


page 46

First, the basic equation,


2
 ----
d-
y = Ax
 dt

Second we begin to integrate, starting at time zero, to time T to get difference equations
2
 ----
d-
 dt y T = Ax 0

 ----
d
-  ----
d
- ∴ ----- y n –  ----- y n – 1 = Ax n – 1 T
d d
(1)
 dt y T = Ax 0 T +  dt y 0 dt  dt
2 2
y T = Ax 0 ----- +  ----- y 0 T + y 0 ∴y n – y n – 1 = Ax n – 1 ----- +  ----- y n – 1 T
T d T d
(2)
2  dt 2  dt

These equations can be solved in two steps, or we can recombine them to get a single
differential equation. We do this by rearranging the last difference equation, and
then we substitute this into the previous difference equation.

2
(2) T  ----
d- T
y n – 1 = y n – y n – 1 – Ax n – 1 -----
dt  2

∴ ----- y n = --- y
d 1 1 T
– --- y – Ax n ---
 dt T n+1 T n 2
 ----
d-  ----
d- --1- --1- T
--- --1- --1- T
---
(1)  dt y n –  dt y n – 1 = Ax n – 1 T = T y n + 1 – T y n – A x n 2 – T y n + T y n – 1 + Ax n – 1 2
2 2
T 2 T
∴– 2y n + y n – 1 + y n + 1 = Ax n ----- – Ax n – 1 T + Ax n – 1 -----
2 2
This can then be shifted back in time one step to make it more useful.

2 2
T T
∴– 2y n – 1 + y n – 2 + y n = Ax n – 1 ----- – Ax n – 2 -----
2 2
2 2
T T
∴y n = 2y n – 1 – y n – 2 + Ax n – 1 ----- – Ax n – 2 -----
2 2

• try the following problem.


page 47

Calculate the position of a 5 Kg mass if a force of 2N is applied for 5 seconds and then
removed. Try the calculations using a 1 second and a 2 second period.

5.1.4 Example of Dead (Delay) Time

• In a real system there is a distance between an actuator, and a sensor. This physical distance
results to a lag between when we actuate something, and when the sensor sees a result.

• Assume we have a simple process where after a change in x there is a delay of ‘m’ time steps
before the proportional change occurs in y. We can write the equation as,

y n = Ax n – m

• Consider the example,


page 48

Calculate the position of a 5 Kg mass if a force of 2N is applied for 5 seconds and then
removed. There is a one second delay between the time that the force is applied, and
when the effects are apparent on the mass.

5.2 DISCRETE CONTROLLERS

• The system models we developed before allow us to predict how a system will behave. A sepa-
rate, and important topic is computer control.

• With no controller we would set an input, and hope for an output. For example, push the gas
pedal and hope for the right speed.

• A controller looks at the desired system condition, and the actual system condition, and then
adjusts the input to bring the desired and actual closer. For example cruise control.

• The diagram below is a representation of a simple control system add to in the previous tank
example,
page 49

h desired + e θ h actual
Controller Process
(valve/tank)
-

Feedback

To make notations more generic we will associate stock variables for desired and actual
positions, as well as error, and controller output. We will also add the discrete
timestep subscripts used before,
r n = h desired
c n = h actual
en = rn – cn
mn = θ

• We have already dealt with deriving an equation for the process. In this case it was the valve
tank combination discussed before. By itself the tank is an open loop system, we set the valve
angle and hope for a liquid level.

•Next, we need to find an equation for the controller. This equation can be highly dependent upon
the control method to be used. If we are to use a computer it is best to have a simple equation,
as shown below, (NOTE: the form of the equation, and the values of the coefficients change
the nature of the control problem).

The basic difference equation is,


mn – mn – 1 = K0 en + K1 en – 1 + K2 en – 2 + K3 en – 3 + K4 en – 4 + …

The ‘output oriented’ form is shown below,


mn = mn – 1 + K 0 en + K 1 en – 1 + K 2 en – 2 + K3 en – 3 + K4 e n – 4 + …

• The controllers (equations) that follow will be put in the above form. These controllers can also
be used individually, or combined to get more complex properties.

• Keep in mind that the typical objective of a control system is to minimize the error between the
input and output. Another common goal is to do this as quickly, or efficiently as possible. One
constraint we must observe is that the system should not become unstable.
page 50

5.2.1 A Proportional Controller

• One of the simplest controllers is the proportional control,

The basic proportional equation is,


m = Ke Note: This form will be
This can be put in discrete form easily, more useful when
dealing with more
m n = Ke n complex controllers.
Finally this can be put into the general form seen before,
m n – m n – 1 = Ke n – Ke n – 1
∴m n = m n – 1 + Ke n – Ke n – 1

• The magnitude of K will determine how fast the system responds. If the value is too large the
system will oscillate and/or become unstable (i.e. flood or go empty). If too small the system
error will be very large. (ie, the tank will never reach the right height.)

• This type of controller will always have a small error between the actual and desired values.

• For the water tank (from before) add a controller, and try varying ‘K’ values.

 Ko  K o
 –T  -----
A 
-
  K i  – T  -----
A
- Ki 
hn = hn – 1  e  + θn – 1  –  e
-----
- +  ------ 
   Ko Ko 
page 51

• We could implement this controller using the Basic stamp chip. (Note: not a full implementa-
tion)

GND +5V +5V

23
potentiometer
21 220
20
1uF
10K 10K

10K
19
-

+
motor
+5V 10K

10K

e_last=0 ‘set previous error to zero


k=2 ‘ set multiplier
r=100 ‘desired water height
m_last=0 ‘ last control output value
loop:
high 15 ‘discharge the capacitor
pause 1 ‘ wait for 1ms
rctime 15,1,c ‘measure charge time
e_now=r-c ‘ calculate the error
m_now=m_last+k*e_now-k*e_last ‘ the controller equation
e_last=e_now
m_last=m_now
pwm 14,m,100 ‘set the output voltage
goto loop
page 52

5.2.2 Integral Control

• Integral controllers tend to respond slowly at first, but over a long period of time they tend to
eliminate errors.

• The integral controller is based on a simple integration.

First we write the general equation for the integrator,


t ASIDE
m = K ∫ e dt
0 integral
In discrete form this becomes,
n

m n = K ∑ Te j
j=1
sum
Putting this into the difference equation yields,
n n–1

m n – m n – 1 = K ∑ Te j – K ∑ Te j = KTe n
j=1 j=1

finally, Note: now the value of the equa-


∴m n = m n – 1 + KTe n tion form become obvious.

• If the constant K is small, the longer term error will slowly drop off. If K is large the long term
error will be reduced quickly. Too large a K value will result in a signal that grows out of con-
trol.

• Try controlling the water tank with the I controller,


page 53

 Ko  K o
 –T  -----
A 
-
  K i  – T  -----
A
- Ki 
hn = hn – 1  e  + θn – 1  –  e
-----
- +  ------ 
   Ko  K o 

5.2.3 Differential Control

• When there is a sudden change in the system the differential controller will be able to compen-
sate. But in terms of long term effects the controller will allow huge steady state errors.

• The control equation can be derived as,

First, the basic equation,

m = K  ----- e
d
dt
Next, this can be written with the backwards difference equation,
en – en – 1
m n = K  -----------------------
 T 
We then apply the difference equation, and put in final form,
en – en – 1 en – 1 – en – 2
m n – m n – 1 = K  ----------------------- – K  ----------------------------- = ---- e n – 2 ---- e n – 1 + ---- e n – 2
K K K
T T T T T
Kd Kd Kd
∴m n = m n – 1 + ------ e n – 2 ------ e n – 1 + ------ e n – 2
T T T
page 54

• This larger the value of K the faster this controller will compensate for a change in the system.

• Try controlling the water tank level with the D controller,

 Ko  K o
 –T  -----
A 
-
  K i  – T  -----
A
- Ki 
hn = hn – 1  e  + θn – 1  –  e
-----
- +  ------ 
   Ko Ko 

5.2.4 Proportional, Integral, Derivative (PID) Control

• The functions of the individual proportional, integral and derivative controllers are complemen-
tary. When combined we get a system that responds quickly to change (derivative), generally
track required positions (proportional), and will eventually reduce errors (integral).

• To get this we combine the expressions from the three individual controllers. Subscripts will be
added to distinguish the ‘K’ gain values for each controller.
page 55

Recall the equations for the three controllers

mn = mn – 1 + Kp e n – K p en – 1 proportional

m n = m n – 1 + K i Te n integral

Kd Kd Kd
m n = m n – 1 + ------ e n – 2 ------ e n – 1 + ------ e n – 2 derivative
T T T
The three differences are added for a new difference equation,
Kd Kd Kd
m n – m n – 1 = ( K p e n – K p e n – 1 ) + ( K i Te n ) +  ------ e n – 2 ------ e n – 1 + ------ e n – 2
T T T

Rearranging results in,


Kd Kd Kd
∴m n = m n – 1 + e n  K p + K i T + ------ + e n – 1  – K p – 2 ------ + e n – 2  ------
T T T

• Quite often the three constants are made the same, giving us the simpler equation below.

m n = m n – 1 + e n  K + KT + ---- + e n – 1  – K – 2 ---- + e n – 2  ----


K K K
 T   T   T

∴m n = m n – 1 + K  e n  1 + T + --- + e n – 1  – 1 – --- + e n – 2  --- 


1 2 1
T T T

• This controller now allows us to vary the three different gains, and as a result we will change the
performance of the system.

• Consider the examples below,


page 56

Given the water tank from before (with the given variables), try a variety of different
values for the PID gains to see how the system responds.

egr450.1.mcd

5.3 BLOCK DIAGRAMS AND TRANSFER FUNCTIONS

• Block diagrams are the primary tool for showing process and control system models.

• In a block diagram each block has one input and one output.

• A transfer function provides functions that are a ratio of block output to block input.

• Consider the block diagram seen before, but with transfer functions (ratio of output to input)
shown for the controller and process.
page 57

Controller Process
rn + en mn cn
Gc ( B ) Gp ( B )

• Both of the transfer functions are ratios of inputs to outputs,

mn cn
G c ( B ) = ------ G p ( B ) = ------
en mn

• These transfer functions (ratios) are rarely a simple multiplication, and so we need to use an
alternate representation called a ‘transform’.

• In this case we will use a backshift transform, hence the ‘B’ in the representation.

• equations for the block diagram below,

Controller Process
rn + en mn cn
Gc ( B ) Gp ( B )

-
page 58

• Recall the techniques for block diagram manipulation.

5.3.1 The Backward-Shift ‘B’ Operator

• An operator is a special part of an equation - one example is the (d/dt) of calculus.

• The basic definition of the backshift operator ‘B’ is,

yn = yn
y n – 1 = By n
2
yn – 2 = B yn
m
yn – m = B yn

• If we apply this operator to an equation seen before,

mn – mn – 1 = K 0 en + K 1 en – 1 + K 2 en – 2 + K 3 en – 3 + K4 e n – 4 + …

2 3 4
m n – Bm n = K 0 e n + K 1 Be n + K 2 B e n + K 3 B e n + K 4 B e n + …
2 3 4
mn K 0 + K1 B + K2 B + K 3 B + K4 B + …
------ = --------------------------------------------------------------------------------------------- = Gc ( B )
en 1–B

• This form then allow some very useful techniques that we will see later.

• Apply the ‘B’ transform to the PID expression found before,


page 59

Kd Kd Kd
m n = m n – 1 + e n  K p + K i T + ------ + e n – 1  – K p – 2 ------ + e n – 2  ------
T T T

• Apply the ‘B’ transform to the valve and water tank found before,

 Ko  K o
 –T  -----
A 
-
  K i  –T  -----
A
- Ki 
hn = hn – 1  e  + θ n – 1  K 
-----
- e +  ------ 
   o  K o 
page 60

5.3.2 Reducing Block Diagrams

• A useful method for this form is the ratio of the actual output to the desired output, (c/r)

Controller Process
rn + en mn cn
Gc ( B ) Gp ( B )

mn cn
G c ( B ) = ------ G p ( B ) = ------ en = rn – cn
en mn

c n = G p ( B )m n = G p ( B )G c ( B )e n = G p ( B )Gc ( B ) ( r n – c n )

∴c n = r n G p ( B )G c ( B ) – c n G p ( B )G c ( B )

∴c n + c n G p ( B )G c ( B ) = r n G p ( B )G c ( B )

cn G p ( B )G c ( B )
∴----- = ---------------------------------------- = G(B) Closed Loop Transfer Function
rn 1 + G p ( B )Gc ( B )

• If we are planning on applying the PID controller to the water tank example from before we get
the following block diagram, (Note: the block diagram is overkill in this application)

 K o
  K i  –T  ----- A
- Ki 
+  ------ 
h desired
K K K θ B  ------ e
e  K p + K i T + ------ + B  – K p – 2 ------ + B  ------   K o  K o  h
d d 2 d
 T  T  T --------------------------------------------------------- actual
+ ------------------------------------------------------------------------------------------------------------  K o-
1–B  –T  ----- A 
- 1 – Be 
 
page 61

• We can find the closed loop transfer function for this process and controller,

G(B) =

• For the problem below, use the PID values, with the valve/tank parameters used previously to
find the system response to a step input to 20 at time zero, and 10 at time 10. (hint: convert the
closed loop equation back to a difference equation)
page 62

K p = 0.1

K d = 0.02

K p = 0.2

5.3.3 Back-Shift Transform Table

• The general application of the table is,


1. Develop the differential equation.
2. Look for the equation in the table. Sometimes the equation will have to be rearranged to
match the form in the table. If it is not in the table, derive the transfer function the
long way.
3. Select the appropriate transfer from the right column, and substitute in values and vari-
ables.
page 63

• A few of the transforms are given below,

Time Domain Back-Shift Domain

INT  ----
D
y = Kx ( t – D ) ( B )-
y----------  T
= KB
x(B )
 ----
d- ( B )-
y---------- KBT
 dt y = Kx x(B )
= ------------
1–B
T
 – ---
τ
τ  ----- y + y = Kx
d KB  1 – e 
 dt y(B )  
----------- = ------------------------------
x(B ) T
– ---
τ
1 – Be
2 2
 ----
d- ( B )-
y---------- KT B ( 1 + B -)
 dt y = Kx x(B )
= -------------------------------
2
2(1 – B)
2
( B )-
y---------- K ( b1 B + b2 B )
d 2
τ  ----- y +  ----- y = Kx
d = ------------------------------------
-
dt dt x(B ) 1 – a1 B – a2 B
2

T T
– --- – ---
τ τ
a1 = 1 + e a2 = –e
T
 – ---
τ
b1 = T – τ  1 – e 
 
T T
– ---
τ  – ---
τ
b 2 = – Te + τ 1 – e 
 
page 64

Time Domain Back-Shift Domain

 1   d 2
 -----2-  ----- y +  ------  ----- y + y = Kx
2ζ d 2
ω n dt ( B )-
y---------- K ( b1 B + b2 B )
 ω n dt = ------------------------------------
-
x(B ) 1 – a1 B – a2 B
2
AND/OR
d 2
( τ 1 τ 2 )  ----- y + ( τ 1 + τ 2 )  ----- y + y = Kx
d
 dt  dt

Case 1: ζ>1 T
– ----
T
– ----
T T
– ---- – ----
τ1 τ2 τ1 τ2
a1 = e +e a2 = –e

T T T T
– ---- – ---- – ---- – ----
τ1 τ2 τ2 τ1
e e - e--------- e---------
--------- – -------- T T –
τ2 τ1 – ---- – ----
τ1 τ2 τ2 τ1
b 1 = 1 + ------------------------ b2 = e + ------------------------
1- ----
---- 1 1- ---- 1
– - ---- – -
τ1 τ2 τ 1 τ2
Case 2: ζ = 1 – Tω n – 2Tω n
a 1 = 2e a 2 = –e
– Tω n – Tω n – Tω n – Tω n
b1 = 1 – e – Tω n e b2 = e (e + Tω n – 1 )
Case 3: ζ<1 ωd = ωn 1 – ζ
2

– Tζω n – 2ζTω n
a 1 = 2e cos ( Tω d ) a2 = –e
– Tζω
ζω n e n
– Tζωn
b 1 = 1 – ------------------------- sin ( Tω d ) – e cos ( Tω d )
ωd
– Tζω n  – Tζω n ζω n
b2 = e e + --------- sin ( Tω d ) – cos ( Tω d )
 ωd 

• Try finding the transfer function for the system below,


page 65

N Ns
K s = 2 ---- K d = 0.5 ------
m m

M=1kg y

5.3.3.1 - A Summary of Differential Equation Solutions

• A quick look at how differential equations relate to difference equations will be useful.

• First order homogenous difference equation,

Equation form,
y n – ay n – 1 = 0
General solution form,

1 –n
y n = C  ---
 a

• second order homogenous difference equation,


page 66

General equation form,


yn – a1 yn – 1 – a2 yn – 2 = 0
First we must examine the roots,
2
a 1 ± a 1 + 4a 2
r 1, r 2 = ------------------------------------
– 2a2
Case 1 - both roots real, and unequal,
–n –n
yn = C1 r1 + C 2 r 2

Case 2 - both roots real, and equal,


–a1 –n –a 1 –n
y n = C 1  -------- + C 2 n  --------
2a 2 2a 2
Case 3 - complex roots
β
θ = atan  ---
2 2 2 2
r 1, r 2 = α ± jβ r = α +β C = C 1 + C2
α
–n –n
yn = r ( C 1 sin ( θn ) + C 2 cos ( θn ) ) = C r sin ( θn + φ )

• Higher order homogenous difference equations,

Given the general form,


yn – yn – 1 + a2 yn – 2 – … – am yn – m = 0

Find the roots for an m-order polynomial,


r 1, r 2, …, r m Equation roots

–n –n –n
yn = C1 r1 + C2 r2 + … + Cm rm

• nonhomogeneous equations
page 67

The general form includes,


y n = homogeous ( y n ) + particular ( y n )

The homogeneous part of the equation is found as normal before.


The particular part of the solution can be found based upon the forcing (input) function,

Particular Solution

K K0
Kn K1 n + K 0
2 2
Kn K2 n + K 1 n + K 0

K sin ( An ) K 1 sin ( An ) + K 2 cos ( An )


n n
KA K0 A

• Solve the following differential equation

2
 ----
d-
 dt y + 2y + 3x = 0

5.3.4 Stability

• Basically a system will become unstable if a transfer function starts to grow. We can predict this
by looking at the characteristic equations.

• The characteristic equation is the denominator of the transfer function.


page 68

• If any of the roots of the equation are less than one, then the system can become unstable, and
most likely will.

2
c-- 1+B+B
= ---------------------------2-
r 1 – 2B + B
2
1 – 2B + B = 0 characteristic equation

∴B = – 1, – 1 therefore the system is unstable

• Determine if the function below is stable, if y is the output,

y n = y n – 1 + 1.05x n – x n – 1

∴y n – By n = 1.05x n – Bx n
yn 1.05 – B
∴----- = --------------------
xn 1–B

continue from here....

What if?
y n = 2y n – 1 + 1.05x n – x n – 1

5.4 SAMPLING FUNCTIONS

• In the last section we looked at a technique for writing equations for discrete variable values.
page 69

This section will start to relate this to the design of controllers and control algorithms.

• Although hinted at earlier, we can now formally define a value ‘sampled’ into the computer.
These values are taken in such a short period of time that they are effectively instantaneous.
But this means that the value does not include changes between samples, and is particularly
prone to noise.

• The unit sample has a magnitude of 1 (and can be multiplied by an input magnitude). The sub-
script can be used to shift it in time. We can relate in the backshift operator, and finally use it to
represent input (generating) functions,

Sn = 1 n = 0
Sn = 0 n≠0
k
S n – k = B Sn
∞ ∞

∑ f ( kT )Sn – k ∑ f ( kT )B Sn
k 2
fn = = = S n ( f ( 0 ) + f ( T )B + f ( 2T )B + … )
–∞ –∞

• As an example develop the expression for the following function assuming a sampling time of 1
s, and then assuming 0.5 s.
page 70

V
4

0 t (sec)
0 1 2 3 4 5

• Table of sampling functions,


page 71

TIME DOMAIN SAMPLE DOMAIN BACKSHIFT DOMAIN


2
Kf ( t ) KF ( B )S n KS n ( f 0 + f 1 B + f 2 B + … )

u( t)  -----------
1 - 2
Sn ( 1 + B + B + … )
 1 – B Sn

KTB - 2 3
Kt ------------------- S
2 n
KTS n ( B + 2B + 3B + … )
(1 – B)
2 2B(B + 1) 2 3
Kt KT ---------------------
3 n
S KTS n ( B + 4B + 9B + … )
(1 – B)

– at K – aT – 2aT 2
Ke ---------------------------
– aT n
-S KS n ( 1 + e B+e B + …)
( 1 – Be )

KB sin ( ωT ) -
K sin ωt ------------------------------------------------- S
2 n
1 – 2B cos ( ωT ) + B
K ( 1 – B cos ( ωT ) ) -
K cos ω t ------------------------------------------------- S
2 n
1 – 2B cos ( ωT ) + B
 A
 2 T) 
int  ------
u( A – t) Sn  1 + B + B + … + B 
 

 A  A
 int  -----
T )
- int ------ + 1
 T ) 
u( t – A ) Sn  B +B + …
 

int  ------
A
a delay of A  T )
B

• Try the previous example using the lookup table,


page 72

V
4

0 t (sec)
0 1 2 3 4 5

5.5 SYSTEM RESPONSE

• Consider that the general form for a transfer function is,


page 73

O
---- = G
I
This can be put in the discrete domain,

On
------ = G ( B )
In
To find the output (response) of a system we can rearrange the equation,
O n = G ( B )I n

Now, we can refer back to the sampled data form, and find a system response ‘H’,
O n = G ( B )F ( B )S n = H ( B )S n

• We can try an example to estimate how a system would respond,

0.085B 0.005B
G ( B ) = -------------------------- I n = -------------------2- S n T = 0.005 s
1 – 0.915B (1 – B)

O n = G ( B )I n =  --------------------------  -------------------2- S n
0.085B 0.005B
1 – 0.915B ( 1 – B )

At this point we need to calculate values. To do this we need to get the expression in
usable form (note: the ‘B’ terms in the denominator can’t be directly applied to Sn).
page 74

APPROACH 1: LONG DIVISION

O n =  --------------------------  -------------------2- S n
0.085B 0.005B
1 – 0.915B ( 1 – B )

 0.000425B
2 
On =  ------------------------------------------------------------------------------ Sn
 1 – 2.915B + 2.830B 2 – 0.915B 3

2 3 4 5
0.000425B + 0.001239B + 0.002409B + 0.003904B +
2 3 2
1 – 2.915B + 2.830B – 0.915B 0.000425B
2 3 4 5
0.000425B – 0.001239B + 0.001203B – 0.000389B
ETC...

2 3 4 5
O n = ( 0.000425B + 0.001239B + 0.002409B + 0.003904B + … )S n

Now we can write down the output values at given times,

Sample # Time (s) Output (V)

0 0.000 0.0
1 0.005 0.0
2 0.010 0.000425
3 0.015 0.001239
4 0.020 0.002409
5 0.025 0.003904
6 0.030 etc...
page 75

APPROACH 2: PARTIAL FRACTIONS


 –---------------
0.085- 
B
 0.085B -  -------------------
0.005B-  0.915 -  -------------------
0.005B-
On = ------------------------- S =  ----------------------  Sn
 1 – 0.915B  2 n
 B – ------------- ( 1 – B ) 2
1
(1 – B)
 0.915
 

On = 
D - -----------
---------------------- + +
F -
E - -------------------
S
1 - 1 – B ( 1 – B ) 2 n
 B – ------------ 
0.915
  –---------------
0.085- 
B 
 B – ------------  
1 - ---------------------- 0.005B- 
0.915 -  -------------------
D = lim     
0.915   1  2
1
B → ------------- B – ------------- ( 1 – B ) 
0.915  0.915 

∴D = lim   – 0.085
-------------   -------------------- 
0.005B
  0.915 B  2 
=
1
B → ------------- (1 – B)
0.915

F =

E =

O n = D( )S n
2
+ E ( 1 + B + B + … )S n
2 3
+ FT ( B + 2B + 3B + … )S n

Now we can write down the output values at given times,

Sample # Time (s) Output (V)

0 0.000 0.0
1 0.005 0.0
2 0.010
3 0.015
4 0.020
5 0.025
6 0.030 etc...
page 76

• Sometimes we don’t want to see the initial changes (transients), but we are more interested in the
long term final value (steady state). We can use the final value theorem to find this,

H ( t → ∞ ) = lim ( 1 – B ) H ( B )
B→1

• Consider the previous function,

O n =  --------------------------  -------------------2- S n
0.085B 0.005B
 1 – 0.915B
(1 – B)

On → ∞ =

5.6 STEADY STATE ERROR

• When we examine a controller, we may look at the value of the error function into the controller.

• If the value of the error function does not become zero at infinity, the system is unstable.

• We can calculate the error value using the function,


page 77

er = rn – cn

• If we consider the example from before,

0.005B
I n = -------------------2- Sn
(1 – B)

O n = G ( B )I n =  --------------------------  -------------------2- S n
0.085B 0.005B
 1 – 0.915B
(1 – B)
Now we can write the error equation,

e r = r n – c n = -------------------2- S n –  --------------------------  -------------------2- S n


0.005B 0.085B 0.005B
 1 – 0.915B  
(1 – B) (1 – B)

∴e r = -------------------2- S n –  --------------------------  -------------------2- S n =  1 – --------------------------  -------------------2- S n


0.005B 0.085B 0.005B 0.085B 0.005B
(1 – B) 1 – 0.915B ( 1 – B ) 1 – 0.915B ( 1 – B )

( 1 – B )0.005B
∴e r =  --------------------------------------------------  -------------------2- S n =  --------------------------------------------------2- S n
1 – 0.915B – 0.085B 0.005B
1 – 0.915B (1 – B) ( 1 – 0.915B ) ( 1 – B )

∴e r =  ------------------------------------------------- S n =  --------------------------------------------- S n
0.005B 0.00546B
 ( 1 – 0.915B ) ( 1 – B )  ( 1.093 – B ) ( 1 – B )

∴e r =  ------------------------------------------------
- S n
0.00546B
 2 
B – 2.093B + 1.093

Next, use long division to convert to an equation,


2 3 4
0.005B + 0.00957B + 0.0137B + 0.0175B + …
2
1.093 – 2.093B + B 0.00546B
2 3
0.00546B – 0.01047B + 0.005B
2 3
0.01047B – 0.005B
2 3 4
0.01047B – 0.02B + 0.00957B
3 4
0.015B – 0.00957B
3 4 5
0.015B – 0.0287B + 0.0137B
ETC..
The magnitude of the error seems to grow without bounds. If this continues to grow
the system will become unstable.
page 78

At this point we should consider using the final value theorem to find if the error settles
to zero,

0.00546B
e ( t → ∞ ) = lim ( 1 – B ) e ( B ) = lim ( 1 – B ) ---------------------------------------------
B→1 B→1 ( 1.093 – B ) ( 1 – B )
0.00546 ( 1 )
∴e ( t → ∞ ) = -------------------------------- = 0.0587
( 1.093 – ( 1 ) )
Here the final steady state error is finite, but defined, so the system is stable. Note that
the output will never match the input.

5.7 PRACTICE PROBLEMS

1. Develop a discrete equation for the following transfer functions. Determine stability and realiz-
ability.

a) 2
5 + 3B + B
G c = ----------------------------2
2 – 3B + B

b)
1–B
G c = -------------------2-
–B+B

c)
2–B
G c = -------------------2-
(3 – B)

2. Develop a differential equation for both the mechanical and the electrical system below. Find
the transfer function for the module using the backshift operator ‘B’ for a time step of T = 1
sec.
page 79

L = 1H

OR
N R = 1 ohm
K s = 1 ----
m F - input

Vin
-
M = 1 kg +
C = 1F Vout
y - output
Ns
K d = 2 ------
m

4. a) Given the following transfer function, and the input function, find the resulting output for the
first 5 time steps, if T=0.5 seconds.

cn 0.5 ( 1 – B )
G = ----- = ------------------------- r ( t ) = 2t
rn (B – 4)

b) What will the steady state output be for the system in part a)?

5. Develop a process model for one of the systems below. Assume the system starts at rest.

L=1 x
R=1
F
C=1
Vout Kd=1
-
M=1
Vin
+

*note input is displacement ‘x’

a) Write the differential equations for one of the systems above.

b) Convert the equation to a transfer function using the backshift operator (use T=1sec).
page 80

c) Assume there is a step input of magnitude 1. Find the output function for the system in terms of
the backshift operator. Do not convert the output function to numerical values in time.

d) Determine the steady state value for the system. Is the value consistent with what you would
expect from the system? Explain.

ANS.
a) V in'' + V in' = – V out x'' + x' = – F

V in  0.368B + 0.264B2 
b) - = – 1  ---------------------------------------------------- = --x-
---------
V out  1 – 1.368B + 0.368B2 F

2
1 – 1.368B + 0.368B
c) F = V out = ---------------------------------------------------------------------
2 3
0.368B – 0.632B + 0.264B

d) F, V out → ∞

e) Yes, it will grow without bounds, and the components are limited by finite bounds.

6. Given the following output function,

O ( B ) =  --------------------------------------------2- S n
10B
0.5 – 0.9B + 0.5B

a) Find the steady state response as a function of time using the tables (assume T=0.2sec).

b) Find the first three values of the output in time using long division. Check that these values
agree with the solution found in part a).

ANS.
a) O ( t ) = 45.886 sin ( 2.255t ) S n
b) 20, 36, 44.8
page 81

6. PETRI NETS

• These are like state diagrams, except multiple states can be active at the same time.

• Other techniques, such as GRAFCET, are based on Petri nets.

6.1 INTRODUCTION

• Ideal for parallel control problems

Token - Indicates place active (control)

Place - Indicates part of a system state (as before). If there is a token


here, the place is valid, or active.

Transition - This will wait until all inputs have a token. Those tokens
are destroyed and new tokens are put into all the outputs

e.g. An example of basic operation

The Petri Net (with no tokens)


page 82

Initial State : The tokens are added below, based upon the system

Step 1 : One of the states gives up a token (this is arbitrary and depends on the state)

transition
condition
fires

Step 2 : Another state gives up a token (again arbitrary)

In this case the transition can fire because both


input places now have tokens, we are only wait-
ing for the condition to occur.
page 83

Step 3: Here the conditions of the transition are met. The two input tokens are con-
sumed and a new token is created for the output place.

Step 4: We see the condition for the transition met.

This continues on indefinitely.........

• Basic logic functions are shown below,


page 84

and
exclusive or
regulator

or action

loop/repeat

if/wait
(state transition)
synchronize

state machines (only 1 input/output on transitions)

• We can model various logic functions with Petri nets,


page 85

And - Both inputs must be present to fire

Recirculator - keeps only one action at a time

Or - one or the other input will start the process

If - this state can chose to send the token on either arc

Parallel - both processes will run in parallel at the same time

• Reachability allows us to determine if a state (set of places) is possible given an initial condition.

• Boundedness determines whether the number of states will be controlled, or grow/shrink.

• Deadlock and liveliness - will the controller find itself unable to continue.

• The procedure for producing ladder logic and other programs from the Petri Nets, is identical to
producing Ladder Logic for SFC diagrams.
page 86

e.g. Petri Net for a single cup coffee maker

money start
added cleaning

cleaning done

cleaning
off

start water start


heater grinder

drop cup
temp. sensor 3 sec delay

heater off stop


grinder

cup removed
filter
coffee

10 sec delay

pour
coffee

Try:
1. Add a coffee strength selection to the Petri Net.
2. Draw the petri net above using a Parallel Process Flowchart
3. Develop some ladder logic for the petri net diagram

• Petri nets have been used for the modeling, control and validation of the control model [Teng
page 87

and Black, 1988]

6.2 IMPLEMENTATION FOR A PLC

• Consider the example of a parts buffer. Parts enter the buffer and are added to the top of the
stack. The part at the bottom of the stack is checked and sorted (ejected differently) based on a
quality check.

keep
alive
T1 part enters
P1 sorter
no part at
waiting for bottom of part ejected
for next sorter
P8
T6 P7
part not P6
entering T5
P2
sorter
part at
T2 bottom
part waiting of sorter

eject P5
part good good
part check
P3
T4

part not good


T3

P4
eject bad

• This can be implemented in ladder logic, but unlike the sequential techniques, there may be mul-
tiple tokens in the places, so counters are used to keep track of token counts.
page 88

first scan
MOV
source 1
dest. CNT C5:1.ACC

RES C5:2

RES C5:3

RES C5:4

RES C5:5

RES C5:6

RES C5:7

RES C5:8

GRT eject bad


source A C5:4.ACC
source B 0

GRT eject good


source A C5:4.ACC
source B 0
page 89

part entering
GRT CTD
source A C5:1.ACC C5:1
source B 0

CTU
C5:2

CTU
C5:7

GRT GRT CTD


source A C5:2.ACC source A C5:6.ACC C5:2
source B 0 source B 0

CTD
C5:6

CTU
C5:3
part good
GRT CTU
source A C5:3.ACC C5:4
source B 0

CTD
C5:3
part good
GRT CTU
source A C5:3.ACC C5:5
source B 0

CTD
C5:3
page 90

GRT CTU
source A C5:5.ACC C5:8
source B 0

CTD
C5:5

GRT CTU
source A C5:4.ACC C5:8
source B 0

CTD
C5:4
part entering
GRT CTU
source A C5:7.ACC C5:1
source B 0

CTD
C5:7
part at sorter bottom
GRT CTU
source A C5:8.ACC C5:6
source B 0

CTD
C5:8

• For practice,
page 91

turn the coffee machine petri net diagram into ladder logic

6.3 PRACTICE PROBLEMS

1. Develop a Petri net to control a part sorting station. Parts enter on a conveyor belt and are
detected by a proximity sensor. The part can then be checked with a vision system that will sig-
nal to the PLC that the part is good/bad. There are then two cylinders that can eject the part into
a good or bad bin.
page 92

7. CONTINUOUS CONTROL SYSTEMS

7.1 CONTROL SYSTEMS

• Control systems use some output state of a system and a desired state to make control decisions.

• In general we use negative feedback systems because,


- they typically become more stable
- they become less sensitive to variation in component values
- it makes systems more immune to noise

• Consider the system below, and how it is enhanced by the addition of a control system.

Control variable

INPUT OUTPUT
(e.g. θgas) SYSTEM
(e.g. velocity)
(e.g. a car)

vdesired verror Driver or θgas vactual


car
+ cruise control
_

The control system is in the box and could be a driver or a cruise control
(this type is known as a feedback control system)
page 93

Human rules to control car (also like expert system/fuzzy logic):

1. If verror is not zero, and has been positive/negative for a while, increase/decrease θgas
2. If verror is very big/small increase/decrease θgas
3. If verror is near zero, keep θgas the same
4. If verror suddenly becomes bigger/smaller, then increase/decrease θgas.
5. etc.

• Some of the things we do naturally (like the rules above) can be done with mathematics

7.1.1 PID Control Systems

• The basic equation for a PID controller is shown below. This function will try to compensate for
error in a controlled system (the difference between desired and actual output values).

u = K c e + K i ∫ edt + K d  ------
de
dt

• The figure below shows a basic PID controller in block diagram form.

proportional PID Controller

Kp ( e )
V V
+ +V
integral
+ e u
Ki ( ∫ e ) amp motor
+
- derivative + -V
K d  ----- e
d
 dt 
page 94

e.g.

dv error
θ gas = K c v error + K i ∫ v error dt + K d  ----------------
 dt 

Rule 4
Rules 2 & 3
(Immediate error)
(general difference)
Rule 1
(Long term error)

Kc
Ki Relative weights of components
Kd

This is a PID Controller

Proportional
Integral
Derivative

For a PI Controller
θ gas = K c v error + K i ∫ v error dt

For a P Controller
θ gas = K c v error

For a PD Controller
dv error
θ gas = K c v error + K d  ----------------
 dt 

• The PID controller is the most common controller on the market.

7.1.2 Analysis of PID Controlled Systems With Laplace Transforms


page 95

1. We can rewrite the control equation as a ratio of output to input.

dv error
θ gas = K c v error + K i ∫ v error dt + K d  ----------------
 dt 

θ gas
- = K c + K i ∫ dt + K d  -----
d
------------
v error  dt

Then do a Laplace transform

d- dx
---- →s ------ → sx
dt dt
1 x
∫ dt = ---
s ∫ xdt = --
s

θ gas Ki The transfer function


L ------------- = K c + ----- + K d s
v error s

2. We can also develop a transfer function for the car.

F = Aθ gas = 10θ gas

F Transfer function for engine and transmission. (Laplace


---------- = 10
θ gas transform would be the same as initial value.)

2
d x dv
F = Ma = M -------2- = M ------
dt dt

F d
--- = M -----
v dt

v 1
L --- = ------- Transfer function for acceleration of car mass
F Ms
page 96

3. We want to draw the system model for the car.

θgas F 1- vactual
10 ------
Ms

• The ‘system model’ is shown above.


• If θgas is specified directly, this is called ‘open loop control’. This is not
desirable, but much simpler.
• The two blocks above can be replaced with a single one.

θgas 10- vactual


------
Ms

4. If we have an objective speed, and an actual speed, the difference is the


‘system error’

v error = v desired – v actual

‘set-point’ - desired system operating point

5. Finally, knowing the error is verror, and we can control θgas (the control variable),
we can select a control system.

verror θgas
Controller

*The coefficients can be calculated using


θ gas K classical techniques, but they are more
L ------------- = K c + -----i + K d s
v error s commonly approximated by trial and
error.
page 97

6. For all the components we can now draw a ‘block diagram’

vdesired verror Ki θgas F 1- vactual


K c + ----- + K d s 10 ------
+ s Ms
-

• A ‘negative feedback loop


that is the fundamental part of this
‘closed loop control system’

7.1.3 Manipulating Block Diagrams

r c
G(s)
+
- r G(s) - c
--------------------------------
is equal to 1 + G ( s )H ( s )

H(s) NEGATIVE FEEDBACK

r c
G(s)
+
+ r G(s) - c
--------------------------------
is equal to 1 – G ( s )H ( s )

H(s)
POSITIVE FEEDBACK
page 98

c c 1 r
r G(s) is equal to -----------
G(s)

r c r c
G(s)
G( s)

is equal to G( s)
c c

r b
H(s) r b
G(s) G ( s )H ( s )
is equal to

r c r c
G(s) G( s)

is equal to 1
-----------
G( s)
r r

e r e
r G( s)
G(s)
is equal to
b 1 b
c -----------
G( s)
page 99

r c r c
G(s) G( s)

is equal to c
c c G( s)

e.g. The block diagram of the car speed control system

vdesired verror Ki θgas F 1- vactual


K c + ----- + K d s 10 ------
+ s Ms
-

vdesired verror K θgas 10- vactual


K c + -----i + K d s ------
+ s Ms
-

= G(s)
vdesired verror vactual
K + K
-----i   ------
10-
+  c s + K d s  Ms
-

H(s) = 1

K + K -----i   ------
10-
vdesired  c s + K d s  Ms vactual
----------------------------------------------------------------------
Ki
1 +  K c + ----- + K d s  ------- ( 1 )
10
s Ms
page 100

 K + K -----i + K d s 
vdesired   c s   vactual
 -----------------------------------------------------
 Ms  K 
 ------- + K c + -----i + K d s 
10  s 

 2 
vdesired  s ( Kd ) + s ( K c ) + ( K i )  vactual
 ------------------------------------------------------------------
 s 2  -----
M  
  10- + K d + s ( K c ) + ( K i )

 2 
v actual  s ( Kd ) + s ( K c ) + ( K i ) 
----------------- =  ------------------------------------------------------------------
v desired  s 2  -----
M  
  10- + K d + s ( K c ) + ( K i )

7.1.3.1 - Commercial PID Tuners

• WARNING: Don’t assume results from these systems are perfect, proper engineering methods
must be used to avoid failures in critical systems.

• EXPERTUNE
• address
G.E.S.
4734 Soneearhray Dr.
Hubertus, WI 53033
tel: (414) 628-0088
• approx. $1500 (U.S.)
• will automatically adjust gain and time constant

• LT/TUNE
• address
Control Soft Inc.
4122 Wyncote Rd.
Cleveland, OH 44121
tel: (216) 234-5759
page 101

7.1.4 Finding The System Response To An Input

• Even though the transfer function uses the Laplace ‘s’, it is still a ratio of input to output.

• Find an input in terms of the Laplace ‘s’

vdesired
100 step
vdesired(t) = 100 for t >= 0 sec
ramp
vdesired(t) = 50t for t >= 0 sec

t(sec)
0

Input type Time function Laplace function


A
STEP f ( t ) = Au ( t ) f ( s ) = ---
s

A
RAMP f ( t ) = Atu ( t ) f ( s ) = ----2
s
2

SINUSOID f ( t ) = A sin ( ωt )u ( t ) f ( s ) = -----------------
2 2
s +ω

PULSE f ( t ) = A ( u ( t ) – u ( t – t1 ) ) f( s) =

etc......
page 102

Therefore to continue the car example, lets assume the input below,

v desired ( t ) = 100 t ≥ 0 sec

100
v desired ( s ) = L [ v desired ( t ) ] = ---------
s

Next, lets use the input, and transfer function to find the output of the system.

v actual
v actual =  ----------------- v desired
 v desired

 2 
 s ( K d ) + s ( K c ) + K i   100
v actual =  -------------------------------------------------------------  ---------
 s 2  -----
M   s
  10- + K d + s ( K c ) + K i

To go further, some numbers will be selected for the values.


Kd = 10000
Kc = 10000
Ki = 1000
M = 1000

 s 2 ( 10000 ) + s ( 10000 ) + 1000  100


v actual =  -----------------------------------------------------------------------
- ---------
 s 2 ( 10100 ) + s ( 10000 ) + 1000  s 
page 103

At this point we have the output function, but not in terms of time yet. To do this
we break up the function into partial fractions, and then find inverse Laplace
transforms for each.

2 
2
s + s + 0.1
v actual = 10  -------------------------------------------------
-
 s ( s ( 1.01 ) + s + 0.1 )
2

Aside: We must find the roots of the equation, before we


can continue with the partial fraction expansion.

recall the quadratic formula,


2
2 – b ± b – 4ac
ax + bx + c = 0 x = --------------------------------------
2a

2
– 1 ± 1 – 4 ( 1.01 ) ( 0.1 )
∴x = ------------------------------------------------------------ = – 0.113, – 0.877
2 ( 1.01 )

2 2
v actual = ----------  ----------------------------------------------------
10 s + s + 0.1
1.01  s ( s + 0.113 )s + 0.877

A B C
v actual = --- + ---------------------- + ----------------------
s s + 0.114 s + 0.795
page 104

2 2 2
A = lim s  ----------  ---------------------------------------------------------  = ----------  -------------------------------------
10 s + s + 0.1 10 0.1
s→0 1.01 s ( s + 0.113 ) ( s + 0.877 ) 1.01 ( 0.113 ) ( 0.877 )

∴A = 99.9

2 2
B = lim  ---------
10 -  --------------------------------------------------------
s + s + 0.1 -  ( s + 0.113 )
s → – 0.113  1.01  s ( s + 0.113 ) ( s + 0.877 ) 

2 2
10 ( – 0.113 ) + ( – 0.113 ) + 0.1
∴B =  ----------  -----------------------------------------------------------------  = 0.264
 1.01  ( – 0.113 ) ( – 0.113 + 0.877 )  

2 2
C = lim  ---------
10 -  --------------------------------------------------------
s + s + 0.1 -  ( s + 0.877 )
s → – 0.877  1.01  s ( s + 0.113 ) ( s + 0.877 ) 

2 2
10 ( – 0.877 ) + ( – 0.877 ) + 0.1
∴C =  ----------  -----------------------------------------------------------------  = – 1.16
1.01 ( – 0.877 ) ( – 0.877 + 0.113 )

99.9 0.264 1.16


v actual = ---------- + ---------------------- – ----------------------
s s + 0.113 s + 0.877
page 105

Next we use a list of forward/inverse transforms to replace the terms in the


partial fraction expansion.

f(t ) f(s )

A
A ---
s

A-
At ---
2
s

– αt A -
Ae -----------
s+α
Aω -
A sin ( ωt ) ----------------
2 2
s +ω

2
– ξω n t 2 ωn 1 – ξ for ( ξ < 1 )
e sin ( ω n t 1 – ξ ) ---------------------------------------
2
-
2
s + 2ξω n s + ω n

etc.

To finish the problem, we simply convert each term of the partial fraction back to
the time domain.

99.9 0.264 1.16


v actual = ---------- + ---------------------- – ----------------------
s s + 0.113 s + 0.877

– 0.113t – 0.877t
v actual = 99.9 + 0.264e – 1.16e

7.1.5 System Response


page 106

• There are two very common systems assumed - first and second order.

• First order systems are very simple, as is shown below.

A A first order system, and a typical response to


G ( s ) = ------------ a stepped input.
s+B

A second order system, and a typical response to


A
G ( s ) = ---------------------------------------
2
-
2
a stepped input.
s + 2ξω n s + ω n

ωn Natural frequency of system, approximate frequency of


control system oscillations.

ξ Damping factor of system. If < 1 underdamped, and system will


oscillate. If =1 critically damped. If < 1 overdamped, and never
any oscillation (more like a first order system). As damping factor
approaches 0, the first peak becomes infinite in height.

7.1.6 A Motor Control System Example

• Condsider the example of a DC servo motor controlled by a computer. The purpose of the con-
page 107

troller is to position the motor. The system below shows a reasonable control system arrange-
ment. Some elements such as power supplies and commons for voltages are omitted for clarity.

2.2K

Computer Running Labview 1K 12Vdc motor

PCI-1200 data aquisition card


-
gain K
from National Instruments
+
LM675
X op-amp
shafts are coupled

-
+
+5V -5V
5K potentiometer

desired position
voltage Vd

• This system can then be redrawn with a block diagram.

desired
position
voltage + gain K
Vd op-amp motor shaft

potentiometer

• The block diagram can now be filled out with actual values for the components. Do this below.
page 108

Given values:
- desired potentiometer voltage
- gain

For the op-amp:

For the potentiometer:


- assume that the potentiometer has a range of 10 turns

For the motor:


- use the differential equation below
2
 ----
d-  -----
K   -----
K-
 dt ω +  JR ω =  JR V s
-

- use the speed curve below from rest when 10V is applied

1400 RPM

1s 2s 3s

For the shaft:


- it turns angular velocity into position
page 109

• Convert the block diagram into a transfer function for the entire system.
page 110

• Pick a value of the gain ’K’ to give a system performance with the damping factor = 1.0.

7.1.7 System Error

• We typically will be interested in system error and feedback error.


page 111

e c
r
G
+
-
b
H

System error, D = r–c

Feedback error, D = r–b

• Consider a simple negative feedback system with various inputs,

Given,
K
G ( s ) = -----p- H( s) = 1
s
c G Kp
∴-- = ------------------ = --------------
-
r 1 + GH s + Kp
First, a step input,
r = A
Kp
c = A  ---------------
 s + K p
Kp ( AK p – AK p ) + s ( A )
D = r – c = A – A  --------------- = ------------------------------------------------- = ---------------
As
s + Kp s + Kp s + Kp

e ss = lim s  --------------- = 0
As
s→0 s + Kp

Next, try a ramp input,


page 112

• Practice problem - find the steady state system error for the transfer function and ramp below,

1 4
G ( s ) = -------------------------
2
- H( s) = 1 R ( s ) = ----2
s + 4s + 5 s

7.1.8 Controller Transfer Functions

• The table below is for typical control system types,


page 113

Type Transfer Function

Proportional (P) Gc = K

G c = K  1 + -----
1
Proportional-Integral (PI) τs

Proportional-Derivative (PD) G c = K ( 1 + τs )

G c = K  1 + ----- + τs
1
Proportional-Integral-Derivative (PID)
τs

1 + ατs
G c = K  ------------------ α>1
1 + τs
Lead
1 + τs
G c = K  ------------------ α>1
Lag 1 + ατs
1 + τ 1 s 1 + ατ 2 s α>1
G c = K  ---------------------  ---------------------
Lead-Lag  1 + ατ 1 s  1 + τ 2 s  τ1 > τ2

7.2 ROOT-LOCUS PLOTS

• Consider the basic transform tables. A superficial examination will show that the denominator
(bottom terms) are the main factor in determining the final form of the solution. To explore this
further, consider that the roots of the denominator directly impact the partial fraction expan-
sion and the following inverse Laplace transfer.

• When designing a controller with variable parameters (typically variable gain), we need to deter-
mine if any of the adjustable gains will lead to an unstable system.

• Root locus plots allow us to determine instabilities (poles on the right hand side of the plane),
overdamped systems (negative real roots) and oscillations (complex roots).

• Note: this procedure can take some time to do, but the results are very important when designing
a control system.

• Consider the example below,


page 114

Note: This controller has adjustable gain. After this design


is built we must anticipate that all values of K will be
used. It is our responsibility to make sure that none of
the possible K values will lead to instability.

+ 1---
K
s
-

K H(s) = 1
G ( s ) = ----
s
First, we must develop a transfer function for the entire control system.
K ----
G ( s )  s K
G S ( s ) = --------------------------------- = --------------------------- = ------------
1 + G ( s )H ( s ) s+K
1 +  ---- ( 1 )
K
s
Next, we use the characteristic equation of the denominator to find the roots as
the value of K varies. These can then be plotted on a complex plane. Note:
the value of gain ’K’ is normally found from 0 to +infinity.

s+K = 0 K root

0
1 K→∞ K = 0 σ
2
3
etc..

Note: because all of the roots for all values of K are real negative this system will
always be stable, and it will always tend to have a damped response. The large the
value of K, the more stable the system becomes.

• Consider the previous example, the transfer function for the whole system was found, but then
only the denominator was used to determine stability. So in general we do not need to find the
transfer function for the whole system.
page 115

Consider the general form for a negative feedback system.

G(s) Note: two assumptions that are not often clearly


G S ( s ) = ---------------------------------
1 + G ( s )H ( s ) stated are that we are assuming that the control
system is a negative feedback controller, and
that when not given the feedback gain is 1.

The system response is a function of the denominator, and it’s roots.


1 + G ( s )H ( s ) = 0
It is typical, (especially in textbook problems) to be given only G(s) or G(s)H(s).

The transfer function values will often be supplied in a pole zero form.
K ( s + z0 ) ( s + z1 )… ( s + z m )
G ( s )H ( s ) = ------------------------------------------------------------------
-
( s + p 0 ) ( s + p 1 )… ( s + p n )

• Consider the example,


page 116

Given the system elements (you should assume negative feedback),


K H(s) = 1
G ( s ) = -------------------------
2
-
s + 3s + 2

First, find the characteristic equation,. and an equation for the roots,

1 +  -------------------------
- ( 1 ) = 0
K
2 
s + 3s + 2
2
s + 3s + 2 + K = 0

– 3 ± 9 – 4(2 + K) 1 – 4K
roots = ------------------------------------------------ = – 1.5 ± --------------------
2 2
Next, find values for the roots and plot the values,
K root

0 0
1 -1 σ
2 -2
3 -3

******CALCULATE AND PUT IN NUMBERS

7.2.1 Approximate Plotting Techniques

• The basic procedure for creating root locus plots is,


1. write the characteristic equation. This includes writing the poles and zeros of the equa-
tion.
page 117

( s + z 1 ) ( s + z 2 )… ( s + z m )
1 + G ( s )H ( s ) = 1 + K ---------------------------------------------------------------- = 0
( s + p 1 ) ( s + p 2 )… ( s + p n )

2. count the number of poles and zeros. The difference (n-m) will indicate how many root
loci lines end at infinity (used later).
3. plot the root loci that lie on the real axis. Points will be on a root locus line if they have
an odd number of poles and zeros to the right. Draw these lines in.
4. determine the asymptotes for the loci that go to infinity using the formula below. Next,
determine where the asymptotes intersect the real axis using the second formula.
Finally, draw the asymptotes on the graph.

± 180° ( 2k + 1 )
β ( k ) = ----------------------------------- k ∈ [ 0, n – m – 1 ]
n–m

( p1 + p2 + … + pn ) ( z 1 + z2 + … + z m )
σ = --------------------------------------------------------------------------------------------
n–m
5. the breakaway and breakin points are found next. Breakaway points exist between two
poles on the real axis. Breakin points exist between zeros. to calculate these the
following polynomial must be solved. The resulting roots are the breakin/breakout
points.

A = ( s + p 1 ) ( s + p 2 )… ( s + p n ) B = ( s + z 1 ) ( s + z 2 )… ( s + z m )

 ----
d-   ----
d- 
 ds A B – A  ds B = 0

6. Find the points where the loci lines intersect the imaginary axis. To do this substitute
the fourier frequency for the laplace variable, and solve for the frequencies. Plot
the asymptotic curves to pass through the imaginary axis at this point.

( jω + z 1 ) ( jω + z 2 )… ( jω + z m )
1 + K --------------------------------------------------------------------------- = 0
( jω + p 1 ) ( jω + p2 )… ( jω + p n )

• Consider the example in the previous section,


page 118

Given the system elements (you should assume negative feedback),


K H(s) = 1
G ( s ) = -------------------------
2
-
s + 3s + 2

Step 1: (put equation in standard form)

1 + G ( s )H ( s ) = 1 +  -------------------------
- ( 1 ) = 1 + K --------------------------------
K 1 -
2  ( s + 1 ) (s + 2)
s + 3s + 2
Step 2: (find loci ending at infinity)

m = 0 n = 2 (from the poles and zeros of the previous step)


n–m = 2 (loci end at infinity)
Step 3: (plot roots)

σ
-2 -1

Step 4: (find asymptotes angles and real axis intersection)


180° ( 2k + 1 )
β ( k ) = -------------------------------- k ∈ I [ 0, 1 ] jω
2
180° ( 2 ( 0 ) + 1 )
β ( 0 ) = ------------------------------------- = 90°
2
180° ( 2 ( 1 ) + 1 ) σ
β ( 1 ) = ------------------------------------- = 270°
2 -2 -1
( 0 )( – 1 – 2)
σ = ----------------------------- = 0
2
asymptotes
page 119

Step 5: (find the breakout points for the roots)


2 jω
A = 1 B = s + 3s + 2

d- d-
---- A = 0 ---- B = 2s + 3
ds ds
σ
A  ----- B – B  ----- A = 0
d d
 ds   ds  -2 -1
2
1 ( 2s + 3 ) – ( s + 3s + 2 ) ( 0 ) = 0 -1.5

2s + 3 = 0
s = – 1.5

Note: because the loci do not intersect the imaginary axis, we know the system will be
stable, so step 6 is not necessary, but we it will be done for illustrative purposes.

Step 6: (find the imaginary intercepts)

1 + G ( s )H ( s ) = 0
1
1 + K -------------------------
2
- = 0
s + 3s + 2
2
s + 3s + 2 + K = 0
2
( jω ) + 3 ( jω ) + 2 + K = 0
2
– ω + 3jω + 2 + K = 0
2
ω + ω ( – 3j ) + ( – 2 – K ) = 0
2
3j ± ( – 3j ) – 4 ( – 2 – K ) 3j ± – 9 + 8 + 4K 3j ± 4K – 1
ω = -------------------------------------------------------------- = ---------------------------------------------- = -------------------------------
2 2 2
In this case the frequency has an imaginary value. This means that there will be no
frequency that will intercept the imaginary axis.

• Plot the root locus diagram for the function below,


page 120

K( s + 5 )
G ( s )H ( s ) = ---------------------------------
2
s ( s + 4s + 8 )

7.2.2 State Variable Control Systems

• State variable matrices were introduced before. These can now be used to form a control system.
page 121

d-
---- X = AX + BU
dt
Y = CX + D

d-
+ ---- X X + Y
U dt 1---
B C
s
+ +

A D

7.3 DESIGN OF CONTINUOUS CONTROLLERS

7.4 PRACTICE PROBLEMS

1. Short answer questions.


a) What is a Setpoint, and what is it used for?
b) What does feedback do in control systems?
c) What is Aliasing and what does it have to do with the Nyquist Criterion?
d) What can A/D and D/A converters be used for in computer control of processes?

2. Simplify the block diagram below.

+ +
A C
- +

3. Given the transfer function below, and the input ‘x(s)’, find the output ‘y(t)’ as a function of
time.
page 122

( s )-
y--------- 5
= ----------- x( t) = 5 t ≥ 0 sec
x( s) s+2

4. Find the steady state error when the input is a ramp with the function r(t) = 0.5t. Sketch the sys-
tem error as a function of time.

R(s) + 5 - R(s)
------------------
s(s + 1)
-

1 + 0.2s

5. Simplify the following block diagram.

G1

-
R + + + C
G2 G3 G5

- -

G4 G6

6. Given the block diagram below, select a system gain K that will give the overall system a
damping ratio of 0.7 (for a step input). What is the resulting undamped natural frequency of the
system?

+ 2
K -------------------------
-
2
s + 3s + 2
-

7. What is the transfer function for a second order system that responds to a step input with an
overshoot of 20%, with a delay of 0.4 seconds to the first peak?
page 123

8. Draw a detailed root locus diagram for the transfer function below. Be careful to specify angles
of departure, ranges for breakout/breakin points, and gains and frequency at stability limits.

2
2K ( s + 0.5 ) ( s + 2s + 2 )-
G ( s ) = -----------------------------------------------------------
3
s (s + 1)(s + 2)

9. Draw the root locus diagram for the system below. specify all points and values.

+ + 1
3.0 -------------------
2
(s + 1)
- -

Kd s

10. Draw the root locus diagram for the transfer function below,

2
K(s + 4)-
G ( s ) = ----------------------
2
s (s + 1)

11. Draw the root locus diagram for the transfer function below,

K(s + 1)(s + 2)
G ( s ) = -------------------------------------
3
s

12. The block diagram below is for a motor position control system. The system has a propor-
tional controller with a variable gain K.
page 124

θd Vd + Ve Vs ω θa
2 K 100- 1---
----------
s+2 s
-
Va

a) Simplify the block diagram to a single transfer function.

ans. 200K
------------------------------------
2
s + 2s + 200K

b) Draw the Root-Locus diagram for the system (as K varies). Use either the approximate or exact
techniques.

ans. – 2 ± 4 – 4 ( 200K )
roots = ------------------------------------------------ = – 1 ± 1 – 200K
2
Im
K roots

0 0,-2 K=0.005
0.001 -0.1,-1.9
0.005 -1,-1 Re
0.1 etc. -2 -1
1
5
10

c) Select a K value that will result in an overall damping coefficient of 1. State if the Root-Locus
diagram shows that the system is stable for the chosen K.

ans. 2
s + 2s + 200K = s + 2ζωn s + ω n
2 2 ∴ω n = 1 ∴K = 0.005

From the root locus graph this value is critically stable.

13. Draw a Bode Plot for either one of the two transfer functions below.
page 125

(-----------------------------------------
s + 1 ) ( s + 1000 -) 5-
OR ---
2 2
( s + 100 ) s

14. The block diagram below is for a servo motor position control system. The system uses a pro-
portional controller.
a) Convert the system to a transfer function.

θd Vd Ve Vm 10 - ω 1--- θa
2 K ----------
s+1 s

Va 2

b) draw a sketch of what the actual system might look like. Identify components.

15. Given the system transfer function below.

θ 20K -
----o- = -----------------------------
θd 2
s + s + 20K

a) Draw the root locus diagram and state what values of K are acceptable.
b) Select a gain value for K that has either a damping factor of 0.707 or a natural frequency of 3
rad/sec.
c) Given a gain of K=10 find the steady state response to an input step of 1 rad.
d) Given a gain of K=10 find the response of the system as
page 126

8. FUZZY LOGIC

• Well suited when we can’t get an exact mathematical model (like we did with Laplace trans-
forms)

• Based on a set of rules, and some fuzzy descriptions about the problem.

• We examine each rule, and each set, and then determine how much each rule applies, and then
perform an operation as a combination of the rule effects.

• The fuzzy logic controller works like the PID before (except it does more)
page 127

e.g.
Suppose we want to control a servo motor [Li and Lau, 1989]

Fuzzy Vmotor Motor vactual


vdesired verror Imotor
Logic Power Servo
+ Motor
- Controller Amplifier

The rules for the fuzzy logic controller would be as below,


1. If verror is LP and d/dtverror is any then Vmotor is LP.
2. If verror is SP and d/dtverror is SP or ZE then Vmotor is SP.
3. If verror is ZE and d/dtverror is SP then Vmotor is ZE.
4. If verror is ZE and d/dtverror is SN then Vmotor is SN.
5. If verror is SN and d/dtverror is SN then Vmotor is SN.
6. If verror is LN and d/dtverror is any then Vmotor is LN.

The sets for verror, d/dtverror, and Vmotor are given below,
d/
verror dtverror Vmotor

1 1 1

LN 0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1

SN 0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1
ZE 0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1
SP rps rps/s V
0 0 0
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1
LP
0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
page 128

After we have the rules, and sets, we must be able to make decisions with the rules
Assume the controller has
verror = 30 rps
d/ v
dt error = 1 rps/s
Determine Vmotor

To do this we look at each rule separately

1. If verror is LP and d/dtverror is any then Vmotor is LP.

1 1 1

0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
ANY VALUE
30rps (so ignore) 17V
(could also
This has about 0.6 (out of 1) membership have chosen
some value
above 17V)

2. If verror is SP and d/dtverror is SP or ZE then Vmotor is SP.


the AND means take the
the OR means take the lowest of the two
highest of the two memberships
memberships

1 1 1 1
rps rps/s V
0 0 0 rps/s 0
-100-50 0 50 100 -6 -3 0 3 6 -6 -3 0 3 6 0 6 12 18 24
1rps/s
30rps 1rps/s 14V

This has about 0.4 (out of 1) membership


page 129

3. If verror is ZE and d/dtverror is SP then Vmotor is ZE.

1 1 1
rps/s
0 rps 0 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
the lowest results in 0 set
30rps 1rps/s membership
This has about 0.0 (out of 1) membership

4. If verror is ZE and d/dtverror is SN then Vmotor is SN.

1 1 1

0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
1rps/s the lowest results in 0 set
30rps
membership
This has about 0.0 (out of 1) membership

5. If verror is SN and d/dtverror is SN then Vmotor is SN.

1 1 1

0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
1rps
30rps
This has about 0.0 (out of 1) membership
page 130

6. If verror is LN and d/dtverror is any then Vmotor is LN.

1 1 1

0 0 0 V
rps rps/s
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

ANY VALUE
30rps
This has about 0 (out of 1) membership

Two of the six rules yielded successful matches, now the results should be combined
into a single value.
n

∑ ( Vmotor ) ( membershipi )
i

i---------------------------------------------------------------------
=1 -
V motor = n

∑ ( membershipi )
i=1

0.6 ( 17V ) + 0.4 ( 14V )


V motor = --------------------------------------------------- = 15.8V
0.6 + 0.4

• This methods has been applied to control of servo motors [Li and Lau, 1988].

8.1 COMMERCIAL CONTROLLERS

• Omron Unit (for PLC)


• 8 inputs, 2 outputs
• 128 rules
• user definable memberships (7 points to define a polygon)

8.2 REFERENCES

Li, Y.F., and Lau, C.C., “Application of Fuzzy Control for Servo Systems”, IEEE International
page 131

Conference on Robotics and Automation, Philadelphia, 1988, pp. 1511-1519.

8.3 PRACTICE PROBLEMS

1. Two fuzzy rules, and the sets they use are given below. If verror = 30rps, and d/dtverror = 3rps/s,
find Vmotor.

1. If (verror is ZE) and (d/dtverror is ZE) then (Vmotor is ZE).


2. If (verror is SP) or (d/dtverror is SP) then (Vmotor is SP).
d
verror /dtverror Vmotor

1 1 1

SN 0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1
ZE 0 rps 0 rps/s 0 V
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24

1 1 1
SP rps rps/s V
0 0 0
-100 -50 0 50 100 -6 -3 0 3 6 0 6 12 18 24
page 132

9. MECHATRONICS CIRCUITS

• These circuits have been selected to be useful for interfacing controls or electronics to physical
devices.

9.1 POWER SWITCHING

9.2 USER INPUT/OUTPUT

9.2.1 Multiplexing

• Large numbers of inputs and outputs tend to use PLCs inefficiently.

• Consider the example of 16 buttons in a keypad. If we connect each button to an input, 16 inputs
will be required. But, it is also possible to connect the buttons to 4 outputs and 4 inputs.

OUTPUTS push-button switches


connect output lines
to input lines

INPUTS

• A similar multiplexing technique can be used for output, as is commonly done for LED digit dis-
plays. (Most red LED displays look constant, but they actually flicker at more than 30Hz).
page 133

BCD to
PLC outputs 7 segment
display
driver
page 134

10. HARDWARE BASED CONTROLLERS

• There are

10.1 CIRCUITS

10.2 FLUIDICS

10.3 PNEUMATICS

10.4 PRACTICE PROBLEMS


page 135

11. EMBEDDED CONTROLLERS

• There are

11.1 TYPES

• 68HC11

11.1.1 Micro Controllers

11.1.2 DSPs

11.1.3 CPUs

11.2 CONTROLLER DESIGN EXAMPLE

11.3 PRACTICE PROBLEMS


page 136

12. DISCRETE SENSORS

• There are a number of system conditions that need to be detected when doing control. These
conditions are most commonly true/false detections, having discrete states.

12.1 INTRODUCTION

• There are a few important concepts when connecting to sensors, including,


- The physical phenomena that allows detection
- The actual wiring of the sensors

12.2 SENSOR WIRING

• There are a variety of basic methods for connecting sensors to devices. These include,
- Plain Switches - normally open or closed to allow current to flow.
- TTL (Transistor Transistor Logic) - for low voltage logic using 0V and 5V.
- Sinking/Sourcing - DC current is drawn through the sensor.
- Solid State Relays - These are used for switching AC outputs.

12.2.1 Switches

• Plain switched outputs usually accompany relays for outputs, or similar devices.

12.2.2 Transistor Transistor Logic (TTL)

• This method switches between two logical DC voltages.

• Typically the low voltage is 0V and it indicates a false condition.

• The true state is normally indicated with a high voltage. 5V is quite common, but other voltages
can be used for certain sensors.

• The voltage levels have certain tolerances built in. For example 0V indicates false, but a voltage
up to 1.2V might still be considered false. This also means there is an ambiguous zone where
the voltage will be judged neither true or false. This zone can be eliminated using schmitt trig-
page 137

gers.

12.2.3 Sinking/Sourcing

• These scheme is used for a variety of reasons.


- they can be made to appear like normal switches.
- they can be used to switch low current devices and hence replace controllers for simple
applications.

• The two types indicate which way the current and voltage are switched to the output. The meth-
ods also refer to transistor types because of the similar behavior (Note: in fact they do use tran-
sistors inside).

• The two main differentiation is,


- Sinking (NPN) - In this case, when actuated, the sensor will connect to ground, or
pull the input low. If this is the case you need to use an output that normally
stays high, true, floats high, etc. The figure below shows an approximate
representation.
page 138

The sensor responds to the physical


V+ phenomenon. If the sensor is
V+
inactive (nothing detected) then
physical the active line is low and the
sensor
phenomenon transistor is off, this is like an
output
open switch. That means the
NPN NPN output will have no current
Sensor in/out, and hence no voltage.
When the sensor is active, it will
make the active line high. This
Active Line will turn on the transistor, and
effectively close the switch.
This will allow current to flow
V- V- into the sensor to ground (hence
sinking). The voltage on the
NPN output will be pulled down
to V-. Note: the voltage will
always be 1-2V higher because
of the transistor.

- Sourcing (PNP) - In this case, when actuated, the sensor will connect to V+, or
pull the input high. If this is the case you need to use an output that nor-
mally stays low, flase, floats low, etc. The figure below shows an approxi-
mate representation.
page 139

The sensor responds to the physical


V+ phenomenon. If the sensor is
V+
inactive (nothing detected) then
physical the active line is low and the
phenomenon transistor is off, this is like an
Active Line open switch. That means the
PNP output will have no current
Sensor in/out, and hence no voltage.
When the sensor is active, it will
PNP make the active line high. This
sensor will turn on the transistor, and
output effectively close the switch.
This will allow current to flow
V- V- from V+ through the sensor to
the output (hence sourcing). The
voltage on the PNP output will
be pulled up to V+. Note: the
voltage will always be 1-2V
lower because of the transistor.

• To directly connect devices to these sensors we can use the arrangement below.

sensor V+ V+
power
NPN supply
V- V-

sensor V+ V+
power
PNP supply
V- V-

Note: remember to check the current and voltage ratings for the sensors.

• It is worth stating the obvious - The output of sensors will be the inputs for other devices, such
as PLCs - this will lead to confusion when specifying PLC input devices. Some manufacturers
page 140

indicate what the input type is, others specify what it is for. This basic result of this is that you
must look at the electrical connections of the card, and not just the designation.

Manufacturer Sensor Type Name of Required Card Type(s)

Allen Bradley NPN


PNP
Aromat NPN
PNP

• Note, if using these sensors with PLCs, care is required to select the appropriate cards and con-
nections. The figure below is for NPN sensors.

PLC Input Sourcing Card (2 DC inputs)

+V current flow
+V
Internal Card Electronics

+V power
NPN supply
NPN sensor -V

00 -V

01 Note: When we have a PLC input card that has


a V+ (not a common) then we can use NPN
sensors. In this case the current will flow
out of the card (sourcing) and we must
PLC Data Bus External Electrical switch it to ground.

ASIDE: This card is shown with 2 optocouplers (one for each output). Inside these
devices the is an LED and a phototransistor, but no electrical connection. These
devices are used to isolate two different electrical systems. In this case they pro-
tect the 5V digital levels of the PLC computer from the various external voltages
and current.

• The figure below is for PNP sensors. These are generally more common combinations.
page 141

PLC Sinking Input Card (2 DC inputs)

+V
00
PNP
PNP sensor current flow
Internal Card Electronics

-V

01

+V
power
supply
-V

com
Note: When we have a PLC input card that has
a common then we can use PNP sensors. In
this case the current will flow into the card
and then out the common to the power sup-
ply.

• It is quite common for manufacturers to offer PLC output cards that will handle PNP and NPN
sensors. In this case the card will require both V+ and a common connection, and the each out-
put must be set for either NPN or PNP.

• Two wire sensors are also common because they reduce the wiring.
page 142

V+
PLC Sinking Input Card
+V
two wire
00 sensor
-V

01 +V
power
supply
-V

com
Note: These sensors require a certain leakage
current to power the electronics.
V+
PLC Sourcing Input Card

00
+V
two wire
sensor
01 -V +V
power
supply
-V

com
page 143

12.2.4 Solid State Relays

• These are fully solid state and are well suited to AC loads.

12.3 CONTACT DETECTION

• At times we want to know when a physical object is present. This may involve touch.

12.3.1 Contact Switches

• Normally open/normally closed

12.3.2 Reed Switches

• These switches are like relays, but using a moving permanent magnet.

With this device the magnet is moved towards the reed switch. As it gets closer the
switch will close. This allows proximity detection without contact, but requires
that a separate magnet be attached to a moving part.

12.4 PROXIMITY DETECTION

• At times we want to know when a physical object is present. This may be a non-contact detec-
tion.
page 144

12.4.1 Optical (Photoelectric) Sensors

• Optical sensors can detect part presence using a light source and detector.

• Emitters generate light in visible and infrared light bands. These are usually LEDs or laser
diodes.

• Detectors are designed to vary electrically as light intensity varies. The most common used is
the phototransistor.

• Ambient light can interfere with a simple optical beam. As a result most sensors now use a mod-
ulated pulse with a frequency up to the low KHz range. This allows better detection at longer
distances with lower power.

square wave
smaller signal
+V +V

lens lens
amplifier
light demodulator
oscillator
detector and
switching circuits
LED
phototransistor

• The relative locations of the source and detectors, as well as surface conditions have a major
impact on the selection of sensor types. These include,
- distance to target
- target characteristics (transparent, reflective, diffuse, etc.)
- target size

• The simplest form uses a detector only with ambient or radiated light.
- ambient light requires care in scene lighting
- radiated light requires some sort of photometric phenomenon such as a hot part will radi-
ate infrared light.

• Optic sensors can often be separated for space and other constraints.
- fiberoptics allow the lens to be separated from the LED or phototransistor.
- the phototransistors and LEDs can be separated from the other circuitry to fit the sensors
page 145

into smaller parts.

• When the emitter and detector are separated and the beam is interrupted this is known as
opposed mode.

emitter object detector

• When the emitter and detector are in a single unit this is known as retroreflective.

reflector

emitter
object

detector

Note: the reflector is constructed with polarizing screens oriented at 90


deg. angles. If the light is reflected back directly the light does not pass
through the screen in front of the detector. The reflector is designed to
rotate the phase of the light by 90 deg., so it will now pass through the
screen in front of the detector.

• Polarized light can be generated using filters.


page 146

emitter
object reflector
have filters for detector light reflected with
emitted light same polarity
rotated by 90 deg.

emitter light rotated by 90 deg.


reflector
detector

• Diffuse sensors are like the retroreflective type, except that the returning light does not need to
be polarized.

emitter
object

detector

Note: with diffuse reflection the light is scattered. This reduces the quantity of light
returned. As a result the light needs to be amplified using lenses.

• Alignment of the emitter is necessary, and can be a problem if the sensors are separated by a
large distance and the beam intensity decreases.
page 147

effective beam

effective
detector detector
angle

emitter
effective alignment
beam angle is required

1
intensity ∝ ---2-
r

• The beam of emitted light should generally be less than the width of the detected part.

emitter object detector

the smaller beam width is good (but harder to align

• Separated sensors can detect reflective parts using specular reflection. This needs a reflective
surface.
em
itt
er

reflective surface
or
ct
te
de
page 148

• By focussing emitters and detectors optics we can sense presence at a specific distance. This is
known as convergent beams sensing.

focal point
emitter

detector

• Fixed field sensors use a physical setting.

distance 1 distance 2
lens
emitter

lens

detector 2

detector 1

• Opposed beams can also be for a large range light curtains.


page 149

• Typical reflectivity values are given below [Banner Handbook of Photoelectric Sensing]

Reflectivity

nonshiny materials Kodak white test card 90%


white paper 80%
kraft paper, cardboard 70%
lumber (pine, dry, clean) 75%
rough wood pallet 20%
beer foam 70%
opaque black nylon 14%
black neoprene 4%
black rubber tire wall 1.5%

shiny/transparent materials clear plastic bottle 40%


translucent brown plastic bottle 60%
opaque white plastic 87%
unfinished aluminum 140%
straightened aluminum 105%
unfinished black anodized aluminum 115%
stainless steel microfinished 400%
stainless steel brushed 120%

Note: For shiny and transparent materials the reflectivity can be higher
than 100% because of the return of ambient light.

• Many sensors have sensitivity adjustments that will need to be adjusted to the materials.
page 150

12.4.2 Capacitive Sensors

• Uses changes in capacitance to detect part presence. Recall the basic equation.

Ak
C = ------ where, C = capacitance (Farads)
d
k = dielectric constant
A = area of plates
d = distance between plates

• Works well with most materials, very good for plastics.

+V
electric
field

electrode oscillator load


object switching

electrode detector

NOTE: For this sensor the proximity of any material near the metal plates will
increase the capacitance. This will vary the magnitude of the oscillating signal
and the detector will decide when this is great enough to determine proximity.

• If the part is conductive it acts as added surface area for the capacitive plates and increases
capacitance. If the part is nonconductive it acts like a dielectric and increases the capacitance.
In total the changes are normally in the order of pF.

electrode metal electrode dielectric

electrode electrode
page 151

• In the sensors the electrodes are normally round rings.

electrode
compensating Note: the compensating electrode us used for
electrode negative feedback to make the sensor
more resistant to variations, such as con-
taminations on the face of the sensor.

• Different materials have various dielectric properties. The list below is a sample from [Turck
Proximity Sensors Guide].
page 152

Material Constant Material Constant

ABS resin pellet 1.5-2.5 hexane 1.9


acetone 19.5 hydrogen cyanide 95.4
acetyl bromide 16.5 hydrogen peroxide 84.2
acrylic resin 2.7-4.5 isobutylamine 4.5
air 1.0 lime, shell 1.2
alcohol, industrial 16-31 marble 8.0-8.5
alcohol, isopropyl 18.3 melamine resin 4.7-10.2
ammonia 15-25 methane liquid 1.7
aniline 5.5-7.8 methanol 33.6
aqueous solutions 50-80 mica, white 4.5-9.6
ash (fly) 1.7 milk, powdered 3.5-4
bakelite 3.6 nitrobenzene 36
barley powder 3.0-4.0 neoprene 6-9
benzene 2.3 nylon 4-5
benzyl acetate 5 oil, for transformer 2.2-2.4
butane 1.4 oil, paraffin 2.2-4.8
cable sealing compound 2.5 oil, peanut 3.0
calcium carbonate 9.1 oil, petroleum 2.1
carbon tetrachloride 2.2 oil, soyean 2.9-3.5
celluloid 3.0 oil, turpentine 2.2
cellulose 3.2-7.5 paint 5-8
cement 1.5-2.1 paraffin 1.9-2.5
cement powder 5-10 paper 1.6-2.6
cereal 3-5 paper, hard 4.5
charcoal 1.2-1.8 paper, oil saturated 4.0
chlorine, liquid 2.0 perspex 3.2-3.5
coke 1.1-2.2 petroleum 2.0-2.2
corn 5-10 phenol 9.9-15
ebonite 2.7-2.9 phenol resin 4.9
epoxy resin 2.5-6 polyacetal (Delrin TM) 3.6
ethanol 24 polyamide (nylon) 2.5
ethyl bromide 4.9 polycarbonate 2.9
ethylene glycol 38.7 polyester resin 2.8-8.1
flour 2.5-3.0 polyethylene 2.3
FreonTM R22,R502 liq. 6.1 polypropylene 2.0-2.3
gasoline 2.2 polystyrene 3.0
glass 3.1-10 polyvinyl chloride resin 2.8-3.1
glass, raw material 2.0-2.5 porcelain 4.4-7
glycerine 47 press board 2-5
page 153

Material Constant Material Constant

quartz glass 3.7 Teflon (TM), PCTFE 2.3-2.8


rubber 2.5-35 Teflon (TM), PTFE 2.0
salt 6.0 toluene 2.3
sand 3-5 trichloroethylene 3.4
shellac 2.0-3.8 urea resin 6.2-9.5
silicon dioxide 4.5 urethane 3.2
silicone rubber 3.2-9.8 vaseline 2.2-2.9
silicone varnish 2.8-3.3 water 48-88
styrene resin 2.3-3.4 wax 2.4-6.5
sugar 3.0 wood, dry 2-7
sugar, granulated 1.5-2.2 wood, pressed board 2.0-2.6
sulfur 3.4 wood, wet 10-30
sulfuric acid 84 xylene 2.4

12.4.3 Inductive Sensors

• These sensors work for all metals (conducting materials).

• These use an oscillating magnetic field.


page 154

inductive coil
metal

+V

oscillator output
and level switching
detector

Note: these work by setting up a high frequency field. If a target nears the field will
induce eddy currents. These currents consume power because of resistance, so
energy is in the field is lost, and the signal amplitude decreases. The detector exam-
ines filed magnitude to determine when it has decreased enough to switch.

• The coils can be shielded to make them more selective to the front of the coils. Unshielded coils
have larger fields and sensitivity to the sides.

• Clearly ferrous targets will work well, but other metals can be used also.

12.4.4 Ultrasonic

• The reflection of sound waves can be used to detect parts or distances.


page 155

• These normally use frequencies above 20KHz which is above the normal human hearing thresh-
old of 16KHz.

• These sensors are commonly,


electrostatic - uses capacitive effects. It has longer ranges and wider bandwidth, but is
more sensitive.
piezoelectric - based on charge displacement during strain in crystal lattices. These are
rugged and inexpensive.

• Good for sensing distances to most materials with surfaces perpendicular to the beam.

• Applications of these are similar to optical sensors.

12.4.5 Hall Effect

• These sensors use a magnetic field in a semiconductor to change current flow.

• As a result these sensors are designed to switch in the presence of a magnetic field.

• these are typically used for no contact limit/home detectors in machines.

12.4.6 Fluid Flow

• A specific fluid flow rate can be detected using a float in a tapered channel.

fluid flow out

float proximity sensor

fluid flow in

As the fluid flow increases the float is forced higher. A proximity sensor
can be used to detect when the float reaches a certain height.
page 156

12.4.7 Other Types

• Other sensors types include,


- color detection

12.5 PRACTICE PROBLEMS

1. Given a clear plastic bottle, list 3 different types of sensors that could be used to detect it.

ans. capacitive proximity


contact switch
photo-optic retroreflective/diffuse
ultrasonic

2. Why is a sinking output on a sensor not like a normal switch?

ans. the sinking output will pass only DC in a single direction, whereas a switch can pass AC and
DC.

3. Select a sensor to pick up a transparent plastic bottle from a manufacturer. Copy or print the
specifications, and then draw a wiring diagram that shows how it will be wired to an appropri-
ate PLC input card.
page 157

ans. A transparent bottle can be picked up with a capacitive, ultrasonic, diffuse optical sen-
sor. A particular model can be selected at a manufacturers web site (eg., www.ban-
ner.com, www.hydepark.com, www.ab.com, etc.) The figure below shows the
sensor connected to a sourcing PLC input card - therefore the sensor must be sink-
ing, NPN.

+ V+
24VDC
- 0

3
V+
sensor
NPN 4
V- 5

4. a) Sketch the connections needed for the PLC inputs and outputs below. The outputs include a
24Vdc light and a 120Vac light. The inputs are from 2 NO push buttons, and also from an opti-
cal sensor that has both PNP and NPN outputs.
page 158

24Vdc 24Vdc
outputs inputs
+
V+ 24VDC 0
-
0 1

1 2

2 3

3 4
V+
optical NPN
4 sensor PNP 5

5 V- 6

6 7

7 com

b) State why you used either the NPN or PNP output on the sensor.

5. List 3 significant trade-offs between inductive, capacitive and photooptic sensors.

6.
page 159

13. CONTINUOUS SENSORS

• There are a number of defining properties of interest when considering sensors,


- Accuracy - a sensor will statistically vary about an exact reading. If we take a statistical
range for all readings (e.g., ±3 standard deviations) this will be a reasonable accu-
racy. Accuracy can also be given as a relative value (e.g. percentage)
- Resolution - Typically used for systems that ‘step’ through readings. This is the smallest
increment that the sensor can detect.
- Repeatability - When a single sensor condition is made and repeated, there will be a
small variation for that particular reading. This is the repeatability.
- Range - Natural limits for the sensor
- Dynamic Response - the frequency range for regular operation of the sensor. Typically
sensors will have an upper operation frequency, occasionally there will be lower
frequency limits.
- Environmental - temperature and humidity limits exist for many sensors
- Calibration - most sensors require some degree of calibration, and their readings may
drift over time.
- Cost

13.1 INPUT ISSUES

• Analog signals are more complicated to deal with than digital signals. This is primarily because
electrical noise will degrade the quality of the signal quickly.

• To deal with this there are a number of measures to be taken,


shielding - shielding is used to reduce the effects of electromagnetic interference.
single/double ended inputs - shared or isolated reference voltages (commons).

• A simple shielding example is shown below. A shielded cable has a metal sheath. This sheath
needs to be connected to the measuring device to allow induced currents to be drained. This
prevents electromagnetic waves to induce voltages in the signal wires.
page 160

A Shield is a metal sheath that Analog Input


surrounds the wires

Analog voltage source

+ IN1
- REF1
SHLD

• The common voltage for each analog signal may be the same but more often it is different. If the
commons are tied together we have a single ended system. If each signal is given its own com-
mon the connections are double ended. Most analog input cards allow a choice between one or
the other.

device + device +
#1 Ain 0 #1 Ain 0
- -
Ain 1 Ain 0
device + device +
#1 Ain 2 #1 Ain 1
- -
Ain 3 Ain 1

Ain 4 Ain 2

Ain 5 Ain 2

Ain 6 Ain 3

Ain 7 Ain 3

COM

Single ended - with this arrangement the Double ended - with this arrangement the
signal quality can be poorer, but more signal quality can be better, but fewer
inputs are available. inputs are available.
page 161

• Signals from transducers are normally small and cannot be directly input into an analog input.
To make these signals more usable Signal Conditioners are used.

• Signal conditioners are normally amplifiers to increase the signal strength, but some will also
change the signal (eg. conversion from current to voltage).

• An example of a simple single ended amplifier is given below,

+V
offset
Rf Rg

-V gain

-
+
Vin Ri
Vout

• An example of a differential amplifier with a current input is given below. Note that Rc converts
a current to a voltage.

-
Iin +
Vout
page 162

• An example of a differential to single ended amplifier is given below.

-
+

-
Vin +
Vout

-
+

CMRR
adjust

• The circuit below can be used to amplify the output of a resistive device.
page 163

+V

R5
R1 R3

-
+
Vout
R2 R4

13.2 SENSOR TYPES

• A list of physical properties, and sensors to measure them is given below,

ELECTRICAL
Property Sensor Input operation typ. accuracy

Voltage voltage transducer 0-5V lin. <1%


Current current transducer 0-5V lin. <1%
KW power integrator 0-5V exc./lin. 0.25%
power factor transducers 0-5V lin. 0.75%
KW-hr pulse initiator 0-5V digital exc. 0.1%

operation = excitation. lineation, compensation, offset


page 164

TEMPERATURE
Property Sensor Input operation typ. accuracy

temperature thermistors resistance lin. 1%


thermocouple 0-80 mV lin./comp. 0.5%
RTD 4-20 mA exc./lin. 0.05%
IC sensor BCD digital exc./lin. 0.01%

ATMOSPHERIC
Property Sensor Input operation typ. accuracy

pressure transducer/transmit. 0-5V,4-20mA exc./lin. 0.5%


humidity RH transmitter 4-20mA exc./lin. 1% RH
precipitation LVDT rain gauge 0-5V exc./lin. 0.25%
solar radiation pyranometer trans. 0-5V exc./lin. 5%
wind direction potentiometer 0-5V exc./lin/off. 1%
wind velocity pulse initiator 5V pulse exc. 1%

FLUIDS
Property Sensor Input operation typ. accuracy

flow transducer 0-5V exc./lin. 0.3%


level transmitter 4-20mA exc./lin. 0.2%

MATERIAL PROPERTIES
Property Sensor Input operation typ. accuracy

strain strain gauge resistance exc./lin. 0.5%

ELECTRONIC
Property Sensor Input operation typ. accuracy

frequency pulse initiator 5V pulse exc. N.A.


page 165

SPATIAL (NEWTONIAN)
Property Sensor Input operation typ. accuracy

acceleration accelerometer
position transducer
velocity velocity pickup

SPATIAL (PRESENCE)
Property Sensor Input operation typ. accuracy

touching contact switch


proximity inductive
capacitive
laser reflection
between optical

• Common transducers,
- Ammeter - meter to indicate electrical current
- Bourdon tube - widely used industrial gage to measure pressure and vacuum
- Chromatographic instruments - laboratory-type instruments used to analyze chemical
compounds and gases.
- Inductance-coil pulse generator - transducer used to measure rotational speed. Output is
pulse train.
- Linear-Variable-Differential transformer (LVDT) electromechanical transducer used to
measure angular or linear displacement. Output is Voltage
- Manometer - liquid column gage used widely in industry to measure pressure.
- Ohmmeter - meter to indicate electrical resistance
- Optical Pyrometer - device to measure temperature of an object at high temperatures by
sensing the brightness of an objects surface.
- Orifice Plate - widely used flowmeter to indicate fluid flow rates
- Photometric Transducers - a class of transducers used to sense light, including photo-
tubes, photodiodes, phototransistors, and photoconductors.
- Piezoelectric Accelerometer - Transducer used to measure vibration. Output is emf.
- Pitot Tube - Laboratory device used to measure flow.
- Positive displacement Flowmeter - Variety of transducers used to measure flow. Typical
output is pulse train.
- Potentiometer - instrument used to measure voltage
- Pressure Transducers - A class of transducers used to measure pressure. Typical output is
voltage. Operation of the transducer can be based on strain gages or other devices.
- Radiation pyrometer - device to measure temperature by sensing the thermal radiation
page 166

emitted from the object.


- Strain Gage - Widely used to indicate torque, force, pressure, and other variables. Output
is change in resistance due to strain, which can be converted into voltage.
- Thermistor - Also called a resistance thermometer; an instrument used to measure tem-
perature. Operation is based on change in resistance as a function of temperature.
- Thermocouple - widely used temperature transducer based on the Seebeck effect, in
which a junction of two dissimilar metals emits emf related to temperature.
- Turbine Flowmeter - transducer to measure flow rate. Output is pulse train.
- Venturi Tube - device used to measure flow rates.

13.3 ANGULAR POSITION

13.3.1 Potentiometers

• A variable resistor is used to convert an angle or displacement to resistance/voltage.

• These give absolute position readings.

• Linear resistors are used for measuring linear displacement.

• The basic principle of operation is that a moving wiper (sensor input) moves a contact along a
resistor. The ends of the resistor are connected to reference voltages. As the wiper moves the
potentiometer acts as a voltage divider and produces a voltage proportional to position.

Vout=V(a/L)
L

• rotational potentiometers are the most popular. These may be limited to a fixed range either less
than 360, or some number of turns.
page 167

Vout θ
Vout = V  -----------
θ max

• Advantages include,
- typically inexpensive
- easy to use
- very common in a variety of forms, resistances, etc.

• Disadvantages include,
- limited accuracy (there are high cost solutions)
- subject to mechanical wear

13.3.2 Encoders

• An incremental encoder will produce a set of output pulses, and a direction as it is rotated.

• The encoder contains an optical disk with fine windows etched into it. As the encoder shaft is
rotated, the etched disk inside rotates. As it rotates various optical sensors are turned on and
off.

• There are two basic types,


absolute - the same shaft position will always give the same position reading
relative/incremental - these just indicate movement, and they require that other circuits or pro-
grams be used to track position

• How the openings are etched onto the disk determine whether it is absolute or relative.
page 168

sensors read across


a single radial line

relative
(quadrature) encoder absolute encoder

• In actual encoders there can be thousands of divisions per rotation.

• With an absolute encoder the output is a binary or gray code number.

• A quadrature pulse counter uses two pulses out of phase and deduces distance and direction.
page 169

Quad input A

clockwise rotation

Quad Input B

Note the change total displacement can be determined


as direction by adding/subtracting pulse counts
is reversed (direction determines add/subtract)

Quad input A

counterclockwise rotation

Quad Input B

To determine direction we can do a simple check. If both are off or on, the first to
change state determines direction. Consider a point in the graphs above where both
A and B are off. If A is the first input to turn on the encoder is rotating clockwise. If
B is the first to turn on the rotation is counterclockwise.

13.3.3 Resolvers

• These use small magnetic coils to detect positions and behave much like relative encoders.

13.3.4 Practice Problems

1. What is the resolution of an absolute optical encoder that has six tracks? nine tracks? twelve
page 170

tracks?

(ans. 360°/64steps, 360°/512seps, 360°/4096 steps)

13.4 LINEAR POSITION

13.4.1 Potentiometers

• A variable resistor is used to convert a displacement to resistance/voltage.

• These give absolute position readings.

• The basic principle of operation is that a moving wiper (sensor input) moves a contact along a
resistor. The ends of the resistor are connected to reference voltages. As the wiper moves the
potentiometer acts as a voltage divider and produces a voltage proportional to position.

Vout=V(a/L)

L
a

13.4.2 Linear Variable Differential Transformers (LVDT)

• This is effectively a transformer with a moving inner core. The moving core changes the induc-
tance, and this can be converted to a position.

• In these devices there are three sets of windings. The first set of windings is in the center, and is
powered by an AC source. The other two coils are at the opposite sides of the main coils. As
the core is moved forward/back the magnetic coupling will change.
page 171

A rod drives
the sliding core

AC input

Signal Out

• If the core shown is in the center, the output will be 0Vac, as it shifts to the left there will be
more coupling between the center and left coil, and the signal magnitude will be larger than the
right hand coil. This difference can be converted to a calculated difference.

• This sensor is used for linear position sensing to high accuracies such as,
- load cells
- bourdon tubes
- dimensional measurement for SPC
- bellows/diaphragm

• The signals from the LVDT can be conditioned with the circuit below.

Vac out Vdc out


Vac in LVDT
page 172

• Near the center of the movement range the voltage is linearly proportional to core movement.

13.4.3 Moire Fringes

• By overlapping two fine lines patterns we can measure displacement.

1. The Pattern - two sheets with thin fringes are put at right angles, the optical effect is
a darkened strip that runs along the strips. As one of the strips is moved the band
will move up or down. When optically magnified the moving strip can be used to
determine direction, and distance of motion.

2. The Detector - a collimated light source is shone upon the pattern. The light is then
reflected back to a grid of sensors. The sensors then go on/off to indicate the pres-
ence of the band.

on
off
on
off

• These are used in high precision applications, and are not available as off the shelf sensors.
page 173

13.4.4 Interferometers

• Uses the fact that when light is 180 degrees out of phase it cancels out.

• By finding the phase between outgoing and returning light (from lasers typically) the distance
can be found.

13.5 VELOCITY

• This can be measured with dedicated sensors.

• We may also differential the output of a position sensor to find a velocity

13.5.1 Velocity Pickups

• Output voltage is proportional to velocity (V/(cm/s))

• These devices have low natural frequencies, and are used for signals with higher frequencies.

• well suited to measuring severe vibrations, but it may be affected by noise from AC sources.

• because signals are velocity, some form of integration must be done, making these devices
bulky, and somewhat inaccurate

• There are two common methods for mounting velocity pickups,


- Magnetic mounts allow fast and easy mounting, but the magnetic mount acts as a slight
spring mass isolator, limiting the frequency range.
- Stud mounted transducers have a thin layer of silicone grease to improve contact

hookup wire

hookup wire

velocity pickup
stud
silicone
velocity pickup grease magnet

surface surface
page 174

13.5.2 Tachometers

• These devices measure the angular velocity of a rotating shaft.

• One way is to connect a DC generator (motor). The faster the shaft turns, the higher the voltage.

• Another technique uses a magnet with a pickup coil. As the magnet passes the coil a pulse is
generated. The pulse magnitude and frequency are proportional to speed.

13.6 ACCELERATION

• Like velocity we may also find acceleration by differentiating velocity, or by differentiating


position twice.

13.6.1 Accelerometers

Sensor
Source of vibrations,
pre- or site for vibration
amp measurement

signal processor/
recorder

Vibration Source - hammers can be used to generate impulse/step function responses.


Load cells/vibrators can be used to excite frequency responses (Bode plots and
phase shift plots)
Sensors - Velocity Pickups/Accelerometers - lightweight devices that are mounted on
structures. They produce small voltages (approx. 10mV). Velocity meters are not
page 175

as accurate as accelerometers. Accelerometers are very common, and are used for
vibrations above 1KHz. Many other sensors are possible.
Preamplifiers - Can power sensors, filter and amplify output.
Signal Processor - Many types used, from software packages, to older pen based plotters,
or tape recorders

• Compared to velocity pickups


- smaller
- more sensitive
- wider frequency range

• electronic integrators can provide velocity and position

• The accelerometer is mounted with electrically isolated studs and washers, so that the sensor
may be grounded at the amplifier to reduce electrical noise.

Sealant to prevent moisture


hookup wire

isolated
stud isolated
accelerometer wafer

surface

• Cables are fixed to the surface of the object close to the accelerometer, and are fixed to the sur-
face as often as possible to prevent noise from the cable striking the surface.

• Background vibrations in factories are measured by attaching control electrodes to ‘non-vibrat-


ing’ surfaces. (The control vibrations should be less than 1/3 of the signal for the error to be
less than 12%)

• Piezoelectric accelerometers typically have parameters such as,


- -100to250°C operating range
- 1mV/g to 30V/g
- operate well below one forth of the natural frequency

• Accelerometer designs vary, so the manufacturers specifications should be followed during


application.

• There is often a trade-off between wide frequency range and device sensitivity (high sensitivity
requires greater mass)

• Two type of accelerometers are compression and shear types.


page 176

• Mass of the accelerometers should be less than a tenth of the measurement mass.

• Accelerometers can be linear up to 50,000 to 100,000 m/s**2 or up to 1,000,000 m/s**2 for


high shock designs.

• Typically used for 10-10,000 Hz, but can be used up to 10KHz

• Temperature variations can reduce the accuracy of the sensors.

• typical parameters are,

sensitivity resonant f (Hz)


4.5 pC/(m/s**2) 22 KHz
.004 180KHz

• These devices can be calibrated with shakers, for example a 1g shaker will hit a peak velocity of
9.81 m/s**2

13.7 FORCE/MOMENT

• These values cannot currently be measured directly, and count on indirect measurements based
on deflections or strain.

13.7.1 Strain Gages

• These devices are attached to surfaces. As the surfaces experience stress/strain the devices are
stretched and the resistance changes.

• The basic theory is based on a stretched wire.


page 177

w
Undeformed

t
L
-

+
I
V L L
R = --- = ρ --- = ρ ------
I A wt
where,
R = resistance of wire
V, I = voltage and current
L = length of wire
w, t = width and thickness
A = cross sectional area of conductor
ρ = resistivity of material
page 178

w’
Deformed

t’
L’

F F
σ = --- = ------ = Eε
A wt
F
L(1 + ε)
R' = ρ -------- = ρ  ----------------------------------------------
L'
w't'  w ( 1 – νε )t ( 1 – νε )

(1 + ε)
∆R = R' – R = R ---------------------------------------- – 1
( 1 – νε ) ( 1 – νε )
where,
ν = poissons ratio for the material
F = applied force
E = Youngs modulusforthematerial
σ, ε = stress and strain of material

• Changes in strain gauge values are typically small (large values would require strains that would
cause the gauges to plastically deform). As a result the resistance values are also small, so we
can use resistor bridges (eg whetstone bridge) to amplify the effect. In this circuit the variable
resistor R2 should be turned until the circuit is balanced for no strain.
page 179

V+

R3
R2 R1

+
Vo

R1
Rstrain
R3

• If the strain gauge is placed in the direction of the strain it will read the full strain. If the gauge is
perpendicular, the reading will be zero.
uniaxial - the direction is critical
rosette - two gauges at 90deg. to each other will measure strain components in two direc-
tion (and can measure shear).

• In some machines (etc.) a strain gauge is often mounted on a narrowed member to measure
force. This is typically known as a load cell.
page 180

mounted in narrow section


to increase strain effect

F F

• Strain gauges are normally made on thin films that are attached (mounted) to surfaces through a
process that involves surface preparation and attachment with adhesives.

13.7.2 Piezoelectric

• These are ceramic and crystal materials that will generate a small amount of charge when
deformed (the capacitance also changes).

• If the deformation is linear,


page 181

b
+
q
-

εab
--q- = εg C = ---------
F t
a
where,
F
C = capacitance
a, b, t = geometry of material
ε = strain of material
q = charge generated
F = force applied
g = constant for material

13.8 FLOW RATE

• Fluid flow rate is important for a number of processes such as cooling and chemical.

13.8.1 Venturi

• A Venturi valve uses a narrow section of a pipe to generate a pressure differential from the nor-
mal pipe diameter. The pressure differential will increase with the velocity of the flow. By
measuring the pressure we can determine the flow rate.
page 182

pressure
transducer

fluid flow

13.9 TEMPERATURE

• Temperature is of significant concern in most disciplines.


- fine temperature measurements 0-100 deg C - e.g. science/laboratory work
- high temperature measurements <3000 deg F - e.g. metal refining/processing
- low temperature measurement 0--60 deg C - e.g. freezers
- very low temperatures <-60 deg C - e.g. superconductors in MRI units
- very high temperatures > 2000 deg C - e.g. fusion research

13.9.1 Resistive Temperature Detectors (RTDs)

• These devices use the effects of temperature change on conductivity.

• Uses resistive wires made of materials such as,


- platinum
- nickel
- copper
- nickel-iron

• Typical material properties are, [Bryan]


page 183

Material Temperature Typical


Range C (F) Resistance
(ohms)

Platinum -200 - 850 (-328 - 1562) 100


Nickel -80 - 300 (-112 - 572) 120
Copper -200 - 260 (-328 - 500) 10

• Wires are wound about an insulator, for support, and covered for protection.

• These devices typically have positive temperature coefficients that cause resistance to increase
linearly with temperature.

• Typical changes are doubling of initial resistance value over range of use.

• Advantages,
- stable
- accurate
- more linear than thermocouples

• Disadvantages,
- expensive
- requires a power supply
- small absolute resistance and resistance change
- self heating

13.9.2 Thermocouples

• Uses a junction of dissimilar metals to generate a voltage proportional to temperature.

• The bimetal junction will generate an electrical potential between the metals as the temperature
increases. The change in voltage is linearly proportional to the change in temperature.

• When using a thermocouple for precision measurement, a second thermocouple can be kept at a
known temperature for reference.

• A series of thermocouples connected together in series produces a higher voltage and is called a
page 184

thermopile.

• Basic thermocouple types are J, K, etc. These are designed for different temperature ranges.

• The basic calculations for thermocouples are given below,

V out = α ( T – T ref ) where,


α = constant (V/K)

T, T ref = temperatures

• Advantages,
- self powered
- simple, rugged
- inexpensive and commonly available
- wide temperature ranges

• Disadvantages,
- nonlinear
- low voltage
- reference devices needed
- least stable and sensitive

13.9.3 Thermistors

• Non-linear devices that change conductivity with temperature. These are usually semiconduc-
tors.

• The resistance drops as the temperature rises. (Note: this is because the extra heat reduces elec-
tron mobility in the semiconductor.) This effect can change the resistance by more than 1000
times.

• The basic calculation for thermistors is given below,

β  --- – -----
1 1
 T T o where,
Rt = Ro e
R o, R t = resistances at reference and measured temps.
T, T o = temperatures
β = constant for device
page 185

• The circuit below can be used to amplify the output of these devices.

+V

R5
R1 R3

-
+
Vout
R2 R4

• These devices are normally small and come as beads or metallized surfaces.

• The advantages of these devices include,


- fast response
- small
- higher resistance reduces the effect of lead impedance
- inexpensive

• Disadvantages include,
- smaller temperature range
- signal is not linear
- very wide resistance range
- self heating

13.10 SOUND

13.10.1 Microphones

• Convert sound pressure to electrical signals


page 186

type sense element freq. range temp. & humidity stability

1. condenser capacitive 2Hz-20KHz fair


2. ceramic piezo-electric 20Hz-10KHz good
3. dynamic magnetic coil 25Hz-15KHz good

• A microphone has a finite area to measure the sound with. As the diameter ‘d’ approaches the
wavelength of sound, the sound becomes distorted.

d << c/f = λ for good measurement

• When wind blows across a microphone, it generates a low frequency turbulence noise. This is
often corrected by using dBA measurements, and foam balls.

• Corrections must also be made for changes in temperature and altitude

1
---
2
C TP = 10 log  -------------------  ------ dB
460 + F 30
 528   B 
Barometric pressure (in Hg)
temperature (F)
correct level to measurement

13.11 LIGHT INTENSITY

13.11.1 Light Dependant Resistors (LDR)


page 187

• These devices change from high resistance (>Mohms) in the dark to low resistance (<Kohms) in
bright light.

• The change in resistance is non-linear, and occurs relatively slowly also.

• A simple comparator circuit is shown below.

V high

V out

V low

• This sensor is relatively easy to design with.

13.12 PRESSURE

13.12.1 Bourdon Tubes

• Converts pressure to a linear translation. Basically a twisted section of flexible tube will try to
straighten out as pressure is applied.

• One end of the tube is fixed, and the other end moves freely as pressure is applied. An LVDT
can be used to measure the position.

13.13 PRACTICE PROBLEMS

1. Suggest a couple of methods for collecting data on the factory floor


page 188

(ans. data bucket, smart machines, PLCs with analog inputs and network connections)

2. If a thermocouple generates a voltage of 30mV at 800F and 40mV at 100F, what voltage will be
generated at 1200F?

1. A certain potentiometer is to be used as the feedback device to indicate position of the output
link of a rotational robot joint. The excitation voltage of the potentiometer equals 5.0 V, and
the total wiper travel of the potentiometer is 300 degrees. The wiper arm is directly connected
to the rotational joint so that a given rotation of the joint corresponds to an equal rotation of the
wiper arm.
a) Determine the voltage constant of the potentiometer Kp,
b) The robot joint is actuated to a certain angle, causing the wiper position to be 38
degrees. Determine the resulting output voltage of the potentiometer.
c) In another actuation of the joint, the resulting output voltage of the potentiometer is
3.75V. Determine the corresponding angular position of the output link.

1. How is the efficiency of a motor defined?

2. What is the relationship between Real Power, Reactive Power and Apparent Power? (A sketch
is acceptable)

3. What is the definition of the power factor of a motor?

4. Name two ways to improve motor efficiency.

5. Name two types of inputs that would be analog input values (versus a digital value).

6. Describe the following as either Transient or Steady State problems with respect to Power
Quality:
Spike _______________________
Electrical Noise _________________________
Tingle Voltage _______________________

13.14 REFERENCES

Bryan, L.A. and Bryan, E.A., Programmable Controllers; Theory and Implementation, Industrial
Text Co., 1988.

Swainston, F., A Systems Approach to Programmable Controllers, Delmar Publishers Inc., 1992.
page 189

14. ACTUATORS

• Actuators cause motion on command in engineered systems.

14.1 ACTUATOR TYPES

• There are a wide range of actuators. Some require simple on/off control while others require
more sophisticated control.

• Some common actuators are,


• Stepper motors
• Servo motors
• Hydraulic valves (to drive hydraulic systems)
• Pneumatic valves (to drive Pneumatic systems)
• Solenoids
• Synchronous motors
• Magnetic coils for attraction, or repulsion
• etc.

• Most suppliers of actuators also sell drivers for their devices. These will amplify small signals
that computers put out, to drive the devices, and these devices occasionally come with position
(or equivalent) feedback abilities.

15. DISCRETE ACTUATORS

15.1 INTRODUCTION

15.1.1 Interfacing

• Outputs are sensitive to power spikes and might inadvertently turn on when there are transient
voltage spikes. A resistor may need to be put in parallel with a load to ensure enough current is
drawn to turn on the triac. The resistor size can be determined by
page 190

PLC output card I = leakage current (mA)

Vac
load
PLC
controlled power
Von supply
TRIAC R

neut.

R < Von/I

15.1.1.1 - Relays

15.1.1.2 - Transistors

• BJT, FET, darlington, etc.

15.1.1.3 - Triacs

15.2 TYPES

15.2.1 Solenoids

• These use a coil of wire to attract a ferrous core when actuated. When the coil is deenergized a
spring will pull the core back out of the coil.

current off current on

• These are particularly bad electrically. There is a large actuation current and when deenergized
page 191

there will be a large inductive spike.

• A very popular application for solenoids is valves. These effectively use the solenoid to drive
pistons that open/close ports on a cylinder.

solenoid

exhaust out power in


The solenoid has two position and when
actuated will change the direction that
fluid flows to the device. The symbols
shown here are commonly used to
represent this type of valve.

solenoid

power in exhaust out

15.2.2 Hydraulic

• Very powerful and well suited to slower speeds with higher forces.

• Use of fluids, and high pressures can make this method awkward, messy, and noisy when
improperly applied.

• Becoming less common in smaller force applications, as electrical systems mature

• Typical hydraulic systems use a simple solenoid valve to actuate devices, some newer develop-
ments use more sensitive devices

• A hydraulic actuation system is shown below

• Higher maximum accelerations that D.C. motors

• small time constants giving smooth operation


page 192

• time constant of hydraulic servo valve is about 5ms

• cylinders have small motions

• rotary motions with gearing are most common

15.2.3 Hydraulics

• Incompressible fluids are used to transmit volume and pressure changes throughout a system.

• Pascal’s law basically describes these systems,

F If a pressure is applied to a non-moving (static)


P = ---
A fluid, the pressure (hydrostatic pressure) the
fluid exerts on all surfaces that it touches are
the same.

• Hydrostatic force/motion multiplier,


page 193

∆x 1 ∆x 2

F2
P, V 2
F1
P, V 1

A1
A2

For Force: F1 A
P = F 1 A1 = F 2 A 2 ∴------ = -----2-
F2 A1

For Motion:
∆V 1 = – ∆ x 1 A 1 = – ∆ V 2 = ∆x 2 A 2

∆x 2 A
∴------------ = -----1-
–∆ x1 A2

• The Hydrodynamic Effect - when fluid is moving quickly, it has high levels of kinetic energy. If
the fluid impacts a surface, it transmits a high quantity of energy in a short period of time.

• Hydraulic Circuits typically contain,


1. Hydraulic Fluid
2. An Oil Reservoir
3. A Pump to Move Oil, and Apply Pressure
4. Pressure Lines
5. Control Valves - to regulate fluid flow
6. Piston and Cylinder - to actuate external mechanisms

• Oil Reservoir
page 194

air filter

fluid return outlet tube

access hatch
for cleaning
refill oil filter

level
gauge

baffle - isolates the


outlet fluid from
turbulence in the inlet

15.2.4 Electric

• DC servo motors
- very common
- well suited to feedback control systems

• Stepper motors
- good for low torque applications
- moves to exact positions, but all accuracy can be lost if the slip-torque is exceeded.

15.2.5 Pneumatic

• good for limited position robots, it is not suited to partial actuation, either on or off.

• Some basic characteristics are,


- stroke from a few millimeters to meters in length (longer strokes have more springiness
- the actuators will give a bit
page 195

- pressures are typically up to 85psi above normal atmosphere


- the cylinder weight can be quite low
- additional equipment is required for a pressurized air supply- linear and rotatory actua-
tors are available.
- dampers can be used to cushion impact at ends of cylinder travel.

15.2.6 Others

• Other types of actuators include,


- heaters
- lights
- sirens/horns

15.3 PRACTICE PROBLEMS

7. A piston is to be designed to exert an actuation force of 120 lbs on its extension stroke. The
inside diameter of the piston is 2.0” and the ram diameter is 0.375”. What shop air pressure
will be required to provide this actuation force? Use a safety factor of 1.3.
page 196

16. CONTINUOUS ACTUATORS

16.1 ACTUATOR CONTROL

• Control systems for devices can be described using block diagrams

• Two main approaches to actuator control


1. Torque controlled by current amplifiers driving a motor
2. Speed controlled by voltage using a voltage amplifier

• Torque control maintains a constant desired torque which is desirable in assembly operations.
Also maintains constant force (gripper) without drawing additional power. A disadvantage
occurs when the required torque is less than the applied torque. This causes higher acceleration
and velocities resulting in the non-zero velocity at the target point and inaccuracies. If the iner-
tia is higher than expected the resisting torque would be larger than the constant applied torque
causing slow motion, and loss of production time.

• Speed control is less affected by variations in inertia and the time to reach the target point is not
affected. The approach is slow and smooth. Problems occur because torque is not controlled.
Motor draws from the voltage amplifier the current required to overcome the disturbance. If
the robot encounters a rigid obstacle the amplifiers fuse could burn-out. This makes it unsuit-
able for assembly tasks such as press fitting where a constant force is required, but it is good
for spray painting and seam welding.

• The choice of control depends on the application and the environment

• Inputs to velocity controlled robots from the computer are,


a) A sequence of pulses - each pulse generates one BRU (Basic Resolution Unit). The number of
pulses represents position and the pulse frequency is proportional to velocity
b) a binary word as samples data - used in most modern robots with both velocity-controlled and
torque controlled systems.

16.1.1 Block Diagrams

• Blocks in the block diagrams will transform energy

• Summation points (circles) will compare, or add quantities

• These diagrams can be used to design physical systems, and the subcomponents
page 197

real world
θ desired + θ error neural τ applied arm position
system and arm structure
muscle
-

θ actual eyes

** This block diagram shows a system that has dynamics, actuators,

feedback sensors, error determination, and objectives

16.1.2 Linear Control Systems

• although these systems are not linear, we can approximate them with linear models and mea-
sures.

** Note: many of the concepts in this section apply to other controls sections as well

• A simple feedback control loop is shown below

θ desired I τ
θactual
Controller Current DC Robot
Amplifier servomotor Joint

• If we expand the above system to system that has second order response we get a system like
that below,
page 198

Ts ( s )
PD Controller
-
θr ( s ) + Vu Ia T 1 θ(s )
Kd s + Kp Ka Kt + -------
2
Js
-

• We can even develop control systems that will compensate for non-linear effects, such as grav-
ity,

Compensated torque loop Controller


1---
T
s
2 s g Ts ( s )

+ + -
+ Vu Ia T 1
Kd s + K p + ˆ + Ka Kt + -------
J 2
θr ( s ) - Js
θ(s

16.1.3 Motor Controllers

• To drive a motor (beyond just turning it on) we will need a power amplifier, and typically a con-
troller.

16.1.3.1 - DC Motors
page 199

command
generator
(PLC,
computer,etc)

motion/position position/
command amplified velocity
voltage/ voltage/ sensor
current power current motor
controller
amp

• Servo loops with DC motors and encoder/resolver feedback are used for positions or velocities

16.1.3.2 - Stepper Motors

• Stepper motors often have no feedback. They use four wires changed in pattern to turn the rotor.

1A Step 1A 2A 1B 2B
2A stepper
controller 1 1 0 1 0
1B motor
2 0 1 1 0
2B 3 0 1 0 1
4 1 0 0 1

To turn the motor the phases are stepped through 1, 2, 3, 4, and then back to 1. To
reverse the direction of the motor the sequence of steps can be reversed, eg. 4,
3, 2, 1, 4, ..... If a set of outputs is kept on constantly the motor will be held in
position.

• Basic types of motor controllers include,


translators - the user indicates maximum velocity and acceleration and a distance to move
indexer - the user indicates direction and number of steps to take
microstepping - each step is subdivided into smaller steps to give more resolution

• These motors do not provide much torque, but they are excellent for positioning applications.
page 200

torque

speed

16.1.3.3 - Separately Excited DC Motor

Armature (rotor) V

Field (stator)
-

Torque equation, T = K t I
Voltage to drive a manipulator motor is
V – IR = K v ω T = magnetic torque (Nm)
I = current in armature circuit (A)
V = voltage supplied to armature (volts)
IR = Voltage drop across thearmaturecircuit
ω = angular velocity (rad/sec)
K t = torque constant
K v = voltage constant
in practice K t = K v

16.1.3.4 - AC Motors
page 201

16.1.3.4.1 - Synchronous

• Synchronous drives - use AC motors with a synthesized frequency signal to control speed

16.1.4 Hydraulic

servo valve
actuating amplifier
servo- hydraulic
signal power
valve
supply

position
hydraulic
actuator

sump
page 202

16.2 PRACTICE PROBLEMS

1. A stepping motor is to be used to drive each of the three linear axes of a cartesian coordinate
robot. The motor output shaft will be connected to a screw thread with a screw pitch of 0.125”.
It is desired that the control resolution of each of the axes be 0.025”
a) to achieve this control resolution how many step angles are required on the stepper
motor?
b) What is the corresponding step angle?
c) Determine the pulse rate that will be required to drive a given joint at a velocity of 3.0”/
sec.

2. For the stepper motor in the previous question, a pulse train is to be generated by the robot con-
troller.
a) How many pulses are required to rotate the motor through three complete revolutions?
b) If it is desired to rotate the motor at a speed of 25 rev/min, what pulse rate must be gen-
erated by the robot controller?
page 203

17. PROGRAMMABLE LOGIC CONTROLLERS

• Considering their popularity, PLCs will be used as the basis for exploring discrete event control
systems.

17.1 BASIC PLCs

• A Programmable Controller (PC) is an input/output processing computer.

• Advantages of PLCs,
- cost effective for complex systems
- flexible
- computational abilities
- trouble shooting aids
- reliable

• Ladder logic was originally introduced to mimic relay logic.

• A thorough review of the research literature is available in Sobh et. al. [1994].

• The PLC can be programmed like other computers using specialized “languages”.

- Ladder Logic - A programming technique using a ladder like structure. This was origi-
nally adopted because of its similarity to relay logic diagrams to ease its accep-
tance in manufacturing facilities. The ladder approach is somewhat limited by the
lack of loops, etc. (Uses JIC standards)
page 204

OUTPUTS

HOT NEUTRAL
INPUTS

POWER NEEDS TO FLOW THROUGH


THE INPUTS TO THE OUTPUTS

- Mnemonic - instructions and opcodes, similar to assembly language. More involved to


program, but also more flexible than ladder logic.

e.g. for an Allen-Bradley PLC

00000 XIO 00001


00001 XIC 00002
00002 AND the mnemonic code is equivalent to
00003 XIC 00003 the ladder logic below
00004 XIC 00004
00005 AND
00006 OR
00007 OTE 00107
00001 00002 00107

00003 00004

END
page 205

- Sequential Function Charts (SFC) - an alternative to a flowchart method for concurrent


operations. Currently this is not widely used, but it (or a similar version) should
become more prevalent in the upcoming years.

Start

function 1

function 3
function 2

End

• Structured text allows programs that are similar to high level languages such as BASIC.

N7:0 := 0
REPEAT
N7:0 := N7:0 + 1;
UNTIL N7:0 >= 10
END_REPEAT;

17.1.1 PLC Connections


page 206

PROCESS

Feedback from Connections to


sensors/switches Actuators

PLC

• The PLC continuously scans the inputs, and changes the outputs.

• The Process can be anything - a large press, a car, a security door, a blast furnace.

• As inputs change (e.g. a start button) the outputs will be changed. This will cause the process to
change, and new inputs to the PLC will be received.

PLC program changes outputs


by examining inputs Set new outputs

THE
CONTROL
LOOP
process changes and PLC pauses
read inputs while it checks its own operation

17.1.2 Ladder Logic

• As mentioned before, ladder logic has been developed to mimic relay logic. This was done orig-
inally to make the computer more acceptable to companies and employees. Original efforts
resisted the use of computers because they required new skills and approaches, but the use of
ladder logic allowed a much smaller paradigm shift, therefore making them more acceptable.

• Original Relay Ladder Logic diagrams show how to hook-up inputs to run outputs.

- Relay - An input coil uses a voltage/current to create a magnetic field. As the coil
becomes magnetic it pulls a metal switch (or reed) towards it, and makes an elec-
trical contact. The contact that closes when the coil is energized is normally open.
page 207

There is a contact that the reed touches without the coil energized is called the nor-
mally closed contact. Relays are used to let one power source close a switch for
another (often high current) power source, while keeping them isolated.

input coil

normally
closed normally
open

Or more simply
OR

- A Circuit - A mix of inputs and outputs allows logical selection of a device.


page 208

115VAC
wall plug

relay logic

output
input (normally open)
(normally closed) input
(normally open)

ladder logic
page 209

push buttons

power
supply
+24V

com.
PLC

inputs

ladder
logic

outputs

115Vac
AC power

neut.

• many relays also have multiple outputs (throws) and this allows an output relay to also be an
input simultaneously. The circuit shown below is an example of this. It is called a seal in cir-
cuit.
page 210

A B

B
Note: When A is pushed, the output B will turn on, and
the input B will also turn on and keep B on perma-
nently - until power is removed.

17.1.3 Ladder Logic Outputs

• The outputs allow switches to close that supply/cut-off power to control devices.

• Ladder logic indicates what to do with the output, regardless of what is hooked up -- The pro-
grammer and electrician that connect the PLC are responsible for that.

• Outputs can go to electrical outputs, or to memory.

• Output symbols,

When power is applied (on) the output x is activated for the left output, but turned
off for the output on the right.

x x

An input transition on will cause the output x to go on for one scan


(this is also known as a one shot relay)
x
OSR
page 211

When L is energized x will be toggled on, it will stay on until U is energized.


This is like a flip-flop and stays set even when the PLC is turned off.
x x
L
U

Some PLCs will allow immediate outputs that do not wait for the program scan to
end before setting an output. (Note: This instruction will only update the outputs using
the output table, other instruction must change the individual outputs.)

x
IOT

17.1.4 Ladder Logic Inputs

• Contact coils are used to connect the PLC power lines to drive the outputs.

• The inputs can come from electrical inputs, or memory locations

Normally open, an active input x will close the contact


and allow power to flow.

Normally closed, power flows when the input x is not open.

x
IIT

immediate inputs will take current values, not those from


the previous input scan. (Note: this instruction is actually
an output that will update the input table with the current
input values. Other input contacts can now be used to
examine the new values.)
page 212

17.2 A SIMPLE EXAMPLE

• Consider the problem below.

Develop a simple relay based controller so that three switches in a room could turn the
light on or off.

17.3 PRACTICE PROBLEMS

(ans. c)

1. Write the mnemonic program for the Ladder Logic below.

201
100

101

(ans. XIC 100, XIC 101, OR, OTE 201)

2. A PLC can be used effectively to,


a) replace a few relays.
page 213

b) replace customized electronics.


c) replace a highly skilled human operator.
d) control a well understood process.

(ans. d)

5. Why would relays be used in place of PLCs?

(ans. for simple designs)

6. Give an example of where a PLC could be used.

(ans. to control a conveyor system)

7. Give a concise description of a PLC.

8. List the advantages of a PLC over relays.

9. Explain the trade-offs between relays and PLCs for control applications.

10. In the figure below, if a limit switch is NO, the power the power flow to the output will nor-
mally be___________________.

#4

#5

(ans. off)

11. In the figure above, if a limit switch input is NC, the power indicator in the input module
should be __________________.

(ans. on)

12. TRUE or FALSE - The left-most side of the PLC’s ladder diagram simulates the power line.

(ans. true)

13. In ladder diagram programs, all outputs are represented by:


a) Contact symbols
b) Coil symbols
c) a or b
page 214

d) None of the above

(ans. b)

14. List the advantages of PLCs over relay logic.

15.
page 215

18. PLC CONNECTION

• Many configurations and packages are available. But essential components are,
- power supply - Provides voltage/current to drive the electronics (often 5V, +/- 12V, +/-
24V)
- CPU - Where ladder logic is stored and processed, the main control is executed here.
- I/O (Input/Output) - A number of input/output terminals to connect to the actual system
- Indicator lights - Indicate mode/power and status. These are essential when diagnosing
problems.

• Common Configurations
- Rack - A rack, or number of racks are used to put PLC cards into, these are easy to
change, and expand.
- Shoebox - A compact, all-in-one unit (about the size of a shoebox) that has limited
expansion capabilities. Lower cost, and compactness make these ideal for small
applications.

18.1 SWITCHED INPUTS AND OUTPUTS

The Obvious:
A PLC is just a computer, we must get information in so that it may make decisions, and
have outputs so that it can make things happen.

Inputs:
Switches - contact, deadman, etc. all allow a voltage to be applied or removed from an
input.
Relays - Used to isolate high voltages from the PLC inputs, these act as switches
Encoder - Can keep track of positions
etc.

• Outputs
Motors - motors often have their own controllers, or relays because of the high current
they require.
Lights - can often be powered directly from PLC output boards.
etc.

• PLCs, and other industrial controls often use methods called sourcing or sinking current for out-
puts of devices. In this method the output of a device does not supply any power. Instead, the
device only switches current on or off.
Sinking - When active the output allows current to flow to a common ground. This is best
selected when different voltages are supplied.
Sourcing - When active, current flows from a supply, through the output though the output
page 216

device and to ground. This method is best used when all devices use a single sup-
ply voltage.

• When selecting sensors


- NPN is sinking
- PNP is sourcing

18.1.1 Input Modules

• Input modules typically accept various inputs, depending upon specified values.

• Typical input voltages are,


12-24 Vdc
48 Vdc
10-60 Vdc
100-120 Vac
5 Vdc (TTL)
200-240 Vac
12-24 Vac/dc
24 Vac

• An example of a PLC input card is shown below.


page 217

PLC Input Card


e.g.
24V AC
normally open push-button
00
24 V AC 01
Power
Supply 02
03
04
normally open 05
temperature switch
06
(See appendix in
textbook for more 07
symbols)

GND

I:013 it is in rack 1
Push Button I/O Group 3
01
I:013
Temperature Sensor
03

Note: outputs are normally high impedance. This means that they will
use very little current.
Note: Only outputs are NPN/PNP or sourcing/sinking

• DC voltages are usually lower, and therefore safer (i.e., 12-24V)

• DC inputs are very fast, AC inputs require a longer time (e.g., a 60Hz wave would require up to
1/60sec for reasonable recognition).

• DC voltages are flexible being able to connect to greater varieties of electrical systems.

• DC input cards typically have more inputs.

• AC signals are more immune to noise than DC, so they are suited to long distances, and noisy
(magnetic) environments.
page 218

• AC signals are very common in many existing automation devices.

ASIDE: PLC inputs must convert a variety of logic levels to the 5Vdc logic levels
used on the data bus. This can be done with circuits similar to those shown below.
Basically the circuits condition the input to drive an optocoupler. This electrically
isolates the external electrical circuitry from the internal circuitry. Other circuit
components are used to guard against excess or reversed voltage polarity.

+5V
optocoupler

DC TTL
input

+5V
AC optocoupler
input
TTL

18.1.2 Output Modules

• WARNING - ALWAYS CHECK RATED VOLTAGES AND CURRENTS FOR PLC’s AND
NEVER EXCEED!

• Typical output voltages are,


12-48 Vac
120 Vac
230 Vac
120 Vdc
page 219

230 Vdc
5Vdc (TTL)
24 Vdc
12-48 Vdc

ASIDE: PLC outputs must convert the 5Vdc logic levels on the PLC data bus to exter-
nal voltage levels. This can be done with circuits similar to those shown below.
Basically the circuits use an optocoupler to switch external circuitry. This electri-
cally isolates the external electrical circuitry from the internal circuitry. Other cir-
cuit components are used to guard against excess or reversed voltage polarity.

+V
optocoupler
TTL
Sourcing DC output

optocoupler
AC
TTL
output

+V
Note: Some AC outputs will
relay also use a zero voltage
output detect. This allows the out-
AC/DC put to be switched on when
the voltage and current are
effectively ‘off’, thus pre-
TTL venting surges.
page 220

• Some output modules allow us to use a single common. We refer to this type of output as current
sinking.

24 V DC 120 V AC
Output Card
Power
Supply
00
COM.
01 Relay
02

03

04 Motor

05
24 V lamp
06

07 +24 V DC
Power
COM Supply
GND
in rack 01
I/O group 2

O:012
Motor
03

O:012
Lamp
07

• Other output modules allow us to use a single voltage supply. We refer to this type of output as
current sourcing.
page 221

24 V DC
Output Card
Power
Supply
V+ +24 V DC GND
00

01 Relay
02 120 V AC
03 Power
Supply
04 Motor COM.

05
24 V lamp
06

07

in rack 01
I/O group 2 O:012
Motor
03

O:012
Lamp
07
page 222

e.g. output example with dry (relay) contacts

120 V AC/DC
Output Card 24 V DC
Power
Supply 120 V AC
00 Power
Supply
01

02

03
Relay
04

05

06 Motor

07
in rack 01
I/O group 2 24 V lamp

O:012
Motor
03

O:012
Lamp
07

• Typical outputs operate in one of two ways.


- Dry contacts - a separate relay is dedicated to each output. This allows mixed voltages
(AC or DC and voltage levels up to the maximum), as well as isolated outputs to
protect other outputs and the PLC. Response times are often greater than 10ms.
This method is the least sensitive to voltage variations and spikes.
- Switched outputs - a voltage is supplied to the PLC card, and the card switches it to dif-
ferent outputs using solid state circuitry (transistors, triacs, etc.) Triacs are well
suited to AC devices requiring less than an amp. Transistor outputs use NPN or
PNP transistors up to 1A typically. Their response time is well under 1ms.
page 223

• Try the following example,

Layout the electrical wiring for the control of a hydraulic press including,
- a double actuated 24VDC solenoid controlled valve for the advance/retract
- a 220VAC, 20A single phase motor for the hydraulic pump
- bottom and top limit switches
- an emergency stop button
- a manual retract button
- an automatic cycle button
page 224

Solution

24VDC output 24VDC input


solenoid
advance I/0
O/0
I/1

retract I/2
O/1
I/3

O/2 I/4

+
com - com
24VDC

• Inductive loads - Inductance is caused by a coil building up a magnetic field. When a voltage is
removed from the coil the field starts to collapse, and as it does this the magnetic field is
changed back to current/voltage. If this change is too sudden a large voltage spike is created.
One way to overcome this is by adding a surge suppressor. One type of design was suggested
by Steel McCreery of Omron Canada Ltd.
page 225

inductive load
output VDC+/VAC
Uncompensated
VDC-/COM.
common

Control Relay (PLC) Power supply

inductive load
output L VAC Compensating
+ for AC loads
C R Vs
-
COM.
common
Relay or Triac Power supply
R = Vs*(.5 to 1) ohms
C = (.5 to 1)/Adc (microfarads)
Vcapacitor = 2(Vswitching) + (200 to 300) V
Adc is the rated amperage of the load
Vs is the voltage of the load/power supply
Vswitching may be up to 10*Vs

inductive load
output + Compensating
for DC loads

-
common
Relay or Transistor Power supply

18.1.2.1 - Relays

• Contactor - special relays for switching of large loads.

• Motor Starter - Basically a contactor in series with an overload relay to cut off when too much
current is drawn.

• Rated Voltage - suggested operation voltage. Lower levels can result in failure to operate, volt-
ages above shorten life.
page 226

• Rated Current - The maximum current before contact damage occurs (welding or melting).

• DC relays require special arc suppression. AC relays have a zero crossing to reduce relay arc
problems.

• AC relays require a shading pole to maintain contact. If a DC relay is used with AC power on
the coil it clicks on-and-off at the frequency of the AC (also known as chattering).

18.2 PRACTICE PROBLEMS

1. TRUE / FALSE -- A PLC input can switch a relay coil to control a motor.

(ans. false - a plc OUTPUT can switch a relay)

2. In the figure below, properly connect the input devices to the contacts shown.

N L1 L2 L3
1
com
2
com
3
com
4
com
5
DC
+ power - com
supply
page 227

ANS.
N L1 L2 L3
1
com
2
com
3
com
4
com
5
DC
+ power - com
supply

3. For the circuit shown in the figure below, list the input and output addresses for the PLC. If
switch A controls the light, switch B the motor, and C the solenoid, write a simple ladder logic
program.
page 228

200

201 A
100
202
101
203
B
102
204
103
205
C
104
206
+
105
207
24VDC
106 +
com
107 12VDC
210 solenoid
valve
com
com
120VAC
211

com

ANS.

outputs: 100 200


200 - light
202 - motor
210 - solenoid
102 202
inputs:
100 - switch A
102 - switch B
104 - switch C
104 210
page 229

4. The main PLC rack refers to an enclosure that contains:


a) several local racks
b) one local and one remote enclosure
c) the processor
d) input and output modules

(ans. c)

5. The digital I/O cards provide the interface between:


a) The PLC and the power supply
b) The CPU and a drop
c) Input modules and CPU
d) External equipment and the PLC

(ans. d)

6. We have a PLC (rack 1) with a 24 VDC input card (slot 3), and a 120VAC output card (slot 2).
The inputs are to be connected to 4 push buttons. The outputs are to drivea 120VAC lightbulb,
a 240VAC motor, and a 24VDC operated hydraulic valve.

a) Draw the electrical connections for the inputs and outputs. Show all other power sup-
plies and other equipment/components required.
b) One of the switches will turn the motor on, another switch turns the motor off. When
the motor is on, the hydraulic solenoid will turn on. The light is on when the motor
is off. Draw a Petri net of the control program.
c) Develop ladder logic for one of the states and one of the transitions.
page 230

ANS.

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 + 7
24VDC
com - com

7. What is the difference between a motor starter and a contactor?

(ans. a motor starter typically has three phases)

8. Is AC or DC easier to interrupt?

(ans. AC is easier, it has a zero crossing)

9. What can happen if the rated voltage on a device is exceeded?

(ans. it will lead to premature failure)

10. What are the benefits of input/output modules?

11. Explain the operation of AC input and output conditioning circuits.

12. What is the wiring difference between a sourcing and sourcing output?

13. What will happen if a DC output is switched by an AC output.

14. You are planning a project that will be controlled by a PLC. Before ordering parts you decide
to plan the basic wiring and select appropriate input and output cards. The devices that we will
use for inputs are 2 contact switches, a push button and a thermal switch. The output will be for
page 231

a 24Vdc solenoid valve, a 110Vac light bulb, and a 220Vac 50HP motor. Sketch the basic wir-
ing below including PLC cards.
page 232

19. PLC OPERATION

19.1 PLC ORGANIZATION

• Remember: The PLC is a computer. Computers have basic components, as shown below.

Keyboard
Input SVGA Screen
Output
Pentium
Serial CPU
Mouse
Input 200/333 MHz
Light output

32MB Memory 2 GB Disk


Storage Storage

• In fact the computer above looks more like the one below,

inputs input memory computer output memory outputs

Keyboard Input Chip


monitor
Screen memory
CPU Pentium chips
Mouse Serial Input Chip
digital output chip LED display

Disk Controller

Memory Chips Disk


storage
page 233

• The thing to notice is that in this computer outputs aren’t connected to the CPU directly.

• A PLC will scan a copy of all inputs from the various inputs, into memory. After this the ladder
logic program is run, and it creates a working table of all outputs in memory also. This table is
written to the outputs only after the ladder logic program is done. This continues indefinitely
while the PLC is on.
** The important point is that the inputs and outputs are “snap-shots” before and after the pro-
gram runs.

• PLC operation can be shown with a time-line.

Self input logic output Self input logic output Self input logic
test scan solve scan test scan solve scan test scan solve

0 ranges from 1 to 100 ms typically time


PLC turns on

- SELF TEST - Checks to see if all cards error free, reset watch-dog timer, etc. (A watch-
dog timer will cause an error, and shut down the PLC if not reset within a short
period of time - this would indicate that the ladder logic is not being scanned nor-
mally).
- INPUT SCAN - Reads input values from the chips in the input cards, and copies their
values to memory. This makes the PLC operation faster, and avoids cases where an
input changes from the start to the end of the program (e.g., an emergency stop).
There are special PLC functions that read the inputs directly, and avoid the input
tables.
- LOGIC SOLVE/SCAN - Based on the input table in memory, the program is executed 1
step at a time, and outputs are updated. This is the focus of the later sections.
- OUTPUT SCAN - The output table is copied from memory to the output chips. These
chips then drive the output devices.

19.2 PLC STATUS

• The PLC keeps track of its status, for internal use, as well as allowing use by the ladder logic.

• Some of the status flags available in PLC’s are,


- Communication errors
- PLC power on, first scan
- Data retention -- PLC restarts with same outputs stopped with
- Battery low
- Scan time too long error
page 234

- I/O error -- problem with one of the I/O cards


- etc.

19.3 MEMORY TYPES

• Basic memory types include,

ROM -

RAM -

EPROM -

EEROM -

FLASH RAM -

19.4 SOFTWARE BASED PLCS

• Software based PLCs run on normal personal computers, but they use software that emulates
dedicated PLCs.

19.5 PROGRAMMING STANDARDS

19.5.1 IEC 1131

• The IEC 1131 standard is an effort towards standardizing PLC oriented control. This is more
necessary now that personal computers and software are starting to open the PLC market.

• These standards were not designed to force a rigid style, so the different PLC vendors will still
have programming environments that vary, but the conceptual elements will be consistent.

• The most notable differences between implementation of PLCs will be addresses of outputs,
inputs, internal memory, etc.

• There are a few components to the standard,


page 235

IEC 1131-3 Data types and programming


IEC 1131-5 Communications
IEC 1131-7 Fuzzy control

• IEC 1131-3 defines the basic programming languages,


IL (Instruction List) - This is effectively mnemonic programming
ST (Structured Text) - A BASIC like programming language
LD (Ladder Diagram ) - Relay logic diagram based programming
FBD (Function Block Diagram) - A graphical dataflow programming method
SFC (Sequential Function Charts) - A graphical method for structuring programs

• Many of the functions described in this note set support the standard.

• The standard also defines data types,

Name Type Bits Range

BOOL boolean 1 0 to 1
SINT short integer 8 -128 to 127
INT integer 16 -32768 to 32767
DINT double integer 32 -2.1e-9 to 2.1e9
LINT long integer 64 -9.2e19 to 9.2e19
USINT unsigned short integer 8 0 to 255
UINT unsigned integer 16 0 to 65536
UDINT unsigned double integer 32 0 to 4.3e9
ULINT unsigned long integer 64 0 to 1.8e20
REAL real numbers 32
LREAL long reals 64
TIME duration not fixed not fixed
DATE date not fixed not fixed
TIME_OF_DAY, TOD time not fixed not fixed
DATE_AND_TIME, DT date and time not fixed not fixed
STRING string variable variable
BYTE 8 bits 8 NA
WORD 16 bits 16 NA
DWORD 32 bits 32 NA
LWORD 64 bits 64 NA

19.5.2 The Future of Open Architecture Controllers

• a PLC is not simply a computer. It contains a computer, with special interfacing abilities. But the
page 236

programming environment is like the Java Virtual Machine. The programs are interpreted
within the ladder logic model. Some features are not available, while others are enhanced.

• Each PLC vendor has developed one or more different PLC models that bare some similarity at
the level of basic inputs and outputs. To unite these models there has been recent work to
develop a common standard so that all PLCs are similar (IEC 1131) but this is not to the point
where it will free the user from a single vendor.

• At the present time inputs and outputs are becoming more flexible, but the central computation
controller (PLC CPU) is still vendor specific. Consider that you can write a program in Java
that will compile on dozens of java compilers.

• There are two possible directions that this might go,


- some third party companies are developing products that are based on other companies
models, such as SoftPLC being based on the PLC-5
- a standards group may be able to develop a standard addressing and instruction set. And
a common execution model may also be developed that will allow vendors to
develop a common engine.

19.6 PRACTICE PROBLEMS

1. PLC’s typically contain:


a) EPROM
b) Battery
c) Both a) and b)
d) None of the above

2. A PLC can only go through the ladder logic a few times per second. Why?

3. Indicator lights are used on PLC’s for,


a) maintenance
b) diagnostics
c) a) and b)
d) none of the above.

(ans. c)

8. What will happen if the scan time for a PLC is greater than the time for an input pulse? Why?

(ans. the pulse may be missed if it occurs between the input scans)

11. What is the difference between a PLC and a desktop computer?


page 237

19. Why do PLCs do a self check every scan?

4. TRUE or FALSE -- The test time for a PLC will be long compared to the time required for a
simple program.

(ans. true)
page 238

20. SWITCHING LOGIC

• In logic based control, decisions are made based on available information.

20.1 BOOLEAN ALGEBRA

• Recall the basic rules of Boolean algebra,


page 239

Idempotent
A+A=A A&A=A

Associative
(A+B)+C=A+(B+C) (A&B)&C=A&(B&C)

Commutative
A+B=B+A A&B=B&A

Distributive
A+(B&C)=(A+B)&(A+C) A & (B + C) = (A & B) + (A & C)

Identity
A + NULL = A A + UNIVERSAL = UNIVERSAL
A & NULL = NULL A & UNIVERSAL = A

Complement
A + ~A = UNIVERSAL ~(~A) = A

A & ~A = NULL ~UNIVERSAL = NULL

DeMorgan’s
~( A + B ) = ~A & ~B ~( A & B ) = ~A + ~B

Duality
interchange AND and OR operators, as well as all Universal, and Null
sets. The resulting equation is equivalent to the original.

- Symbols for Boolean operations may look different


AND, *, •, &
OR, +
NOT, ~, A
etc.

e.g.
A=B*(C*(D+E+C)+F*C)
A = B * C ------------------------------------ Simplified Form
page 240

A = B*C*D + B*C*E + B*C*F + B*C ----- Canonical/Disjunctive normal form

20.2 DISCRETE LOGIC

• The basic types of discrete logic problems are,


1. Conditional - if a set of conditions can directly cause an action.
e.g. if the temperature is too high and there is an ingot in only one bay, turn
on fan 1.
B1 = bay 1 ingot detect
B2 = bay 2 ingot detect
F1 = fan 1
T1 = temperature overheat sensor

in Boolean F1 = T1 * (B1 EOR B2)


or F1 = T1 * (( B1 * B2 ) + ( B2 * B1 ))
or F1 = T1 * B1 * B2 + T1 * B2 * B1

In ladder logic,

Note: recall the rules of Boolean algebra

B1 B2 T1
F1

B1 B2 * the result for conditional logic is a single


step in the ladder

2. Sequential - when the system is in a certain state, the controls will do certain things.
e.g., when an oven is on, the PLC adjusts temperature.When it is off doors
can be opened/closed.
page 241

ladder logic for


temperature control
only used when
oven on

ladder logic for


doors only used
when oven off

• Try the example shown below,


page 242

A
B
C
X
B
A

Develop the Boolean equation for the circuit above. Simplify the expression, and
then convert this to ladder logic, a digital circuit, and a computer program.

X =  ( ABC ) + B B ( A + C )

X = ( A + B + C + B )B ( AC )

X = ( ABAC + BBAC + CBAC + BBAC )

X = ( BAC + BAC + 0 + BAC )

X = BAC

• Consider the more complicated design that follows,


page 243

A = B * ( C * ( D + E + C ) + F * C ) ---- Original equation


* remember operations in brackets are done first, like normal algebra

D
E
C

B
The gates can be purchased for
about $0.25 each in bulk.
Inputs and outputs are
D C B typically 5V
A

E
An inexpensive PLC is worth
at least a few hundred dollars
C

F C

Consider the cost trade-off!


page 244

A = B * C * ( D + E + F ) ---- Simplified Form

D
E
F A
C
B

D C B A

A = (B * C * D ) + (B * C * E ) + (B * C * F ) ---- Disjunctive Normal Form

B
C
D
A

B C D A

B C E

B C F
page 245

20.2.1 Boolean Algebra for Circuit and Ladder Logic Design

• When we have logical decisions to make, truth tables and Boolean algebra allow formal meth-
ods to be used. The use of formal methods improves the overall quality of the design.

• Consider the example of a burglar alarm


1. If alarm is on, check sensors.
2. If window/door sensor is broken (turns off), sound alarm and turn on lights
3. If motion sensor goes on (detects thief) sound alarm and turn on lights.

A = Alarm and lights switch (1 = on)


W = Window/Door sensor (1 = OK)
M = Motion Sensor (0 = OK)
S = Alarm Active switch (1 = on)

System Truth Table


Inputs Output
S M W A
0 0 0 0
0 0 1 0
0 1 0 0 alarm off
0 1 1 0
1 0 0 1 alarm on/no thief
1 0 1 0
1 1 0 1
1 1 1 1 alarm on/thief detected

note the binary sequence


page 246

A = (S ⋅ M ⋅ W) + (S ⋅ M ⋅ W) + (S ⋅ M ⋅ W)
∴A = S ⋅ ( M ⋅ W + M ⋅ W + M ⋅ W )

∴A = S ⋅ ( ( M ⋅ W + M ⋅ W ) + ( M ⋅ W + M ⋅ W ) )

∴A = ( S ⋅ W ) + ( S ⋅ M ) = S ⋅ ( W + M )
We can now draw an electronic circuit for one of the equations

W W (S*W)
(S*W)+(S*M)

S
A

M
(S*M)

We can also do this with ladder logic

M S A

W S

We can also simplify both the circuit and the ladder

W W (M+W) S * (M+W)
M = (S*W)+(S*M)

S A

M S A

W
page 247

This logic can also be implemented in an embedded controller

w = 1; s = 2; m = 3; a = 4
input m; input w; input s
output a
loop:
if (in2 = 1) and (in1 = 0 or in3 = 1) then on
low a; goto loop ‘alarm off
on:
high a; goto loop ‘alarm on

• This example was quite simple. To do more complicated problems we will need to review some
basic theory first.

20.2.2 Boolean Forms

• Canonical, truth tables

20.3 SIMPLIFYING BOOLEAN EQUATIONS

20.3.1 Karnaugh Maps for Combinatorial Design

• Karnaugh maps allow us to convert a truth table to a simplified Boolean expression without hav-
ing to use Boolean Algebra.

• Consider the example below,


page 248

We will add an alarm quit switch to the last example


therefore,
A, W, M, S as before
Q = Alarm Quiet ( 0 = quiet )
Step1 : Draw the truth table
S M W Q A
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 0
1 1 1 1 1

Step 2 : Divide the input variables up. I choose SQ and MW

Step 3 : Draw a Karnaugh map based on the input variables

MW (=00) MW (=01) MW (=11) MW (=10)


SQ (=00)
SQ (=01)
SQ (=11) 1 1 1
SQ (=10)

Added for clarity


page 249

Step 4 : Look for patterns in the map


M is the common term
MW MW MW MW
SQ
SQ
SQ 1 1 1
SQ
W is the common term

In addition to the common terms, These both occur in row SQ, therefore,
A = S*Q*(W) + S*Q*(M)
A = S*Q*(W + M)

M S Q A

*This technique works well for complicated systems.

• Design ladder logic for a car that considers,


page 250

- doors opened/closed (D)


- windows (W)
- keys in ignition (K)
- motor running (M)
- transmission in park (P)
- etc (?)

20.4 ADDITIONAL TOPICS

20.4.1 Negative Logic

• Some applications will use negative logic. Effectively this is the opposite of positive logic.
Positive Logic - a high/low voltage or current level indicates a true/false condition
Negative Logic - a low/high voltage or current level indicates a true/false condition

• This is common in a variety of applications. Reasons include,


- we want current to flow when things are alright, consider an E-stop.
- a device input “floats high” so that when there is no input it turns on. This is common
with many integrated circuits.
page 251

20.4.2 Common Logic Forms

• Recognizing certain logic forms allows faster identification and solution of design problems.

• These include,
- Comparitors
- Decoders
- Code conversion
- Adders/Subtractors

20.4.2.1 - NAND/NOR Forms

• Remember the basic forms for NAND and NOR and then apply de’Morgan’s theorem.

NAND NOR
X = A⋅B X = A+B

X = A+B X = A⋅B

A X
A B X
B

20.4.2.2 - Multiplexers

• Multiplexors allow us to select a single output from several inputs.


page 252

A1 A3 X
D1 multiplexor
0 0 X=D1
D2 X 0 1 X=D2
1 0 X=D3
1 1 X=D4
D3

D4

A1 A2

• In ladder logic this can be done as below,

A1 A2 D1 X

A1 A2 D2

A1 A2 D3

A1 A2 D4

• Demultiplexers work in reverse.

20.4.2.3 - Seal-in Circuits


page 253

20.5 DESIGN CASES

20.5.1 Logic Functions

Part A - Develop a program that will cause output D to go true when switch A and switch B are
closed or when switch C is closed.
Part B - Develop a program that will cause output D to be on when push button A is on, or either
B or C are on.

A B
D

A
D

20.5.2 Car Safety System

Develop Ladder Logic for a car door/seat belt safety system. When the car door is open, or the
seatbelt is not done up, the ignition power must not be applied. If all is safe then the key will
start the engine.
page 254

Door Open Seat Belt Key


Ignition

20.5.3 Motor Forward/Reverse

• Design a motor controller that has a forward and a reverse button. The motor forward and
reverse outputs will only be on when one of the buttons is pushed. When both buttons are
pushed the motor will not work.

20.6 PRACTICE PROBLEMS

1. Draw a ladder diagram that will cause output D to go true when switch A and switch B are
closed or when switch C is closed. The devices are wired to the following locations.

Input A is 001
Input B is 002
Input C is 003
Output D is 201
page 255

ANS.
001 002 201

003

2. Draw a ladder diagram that will cause output D to be on when push button A is on, or either B
or C are on.

Input A is 001
Input B is 002
Input C is 003
Output D is 201

ANS. 002 003


201

002 003

001

4. Make a simple ladder logic program that will turn on the outputs with the binary patterns when
the corresponding buttons are pushed. Assume that the outputs are from 200 to 207 and that 200 is
the LSB)

11011011 (input 101)


10101010 (input 102)
10010010 (input 103)
page 256

101 207

102

103

101 206

102 205

101 204

103

ETC....

7. Given the truth table below


page 257

A B C D Z
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
a) find a Boolean algebra expression using a Karnaugh map.
b) draw a ladder diagram using the truth table (not the Boolean expression).
page 258

ANS.
AB AB AB AB
CD 1 0 0 1

CD 1 0 0 1 Z=B*(C+D)+ABCD

CD 0 0 0 0

CD 1 1 0 1

A B C D Z

A B C D

A B C D

A B C D

A B C D

A B C D

A B C D

8. Simplify the Boolean expression below.

((A ⋅ B) + (B + A)) ⋅ C + (B ⋅ C + B ⋅ C)

ans. =C

9. Given the Boolean expression a) draw a digital circuit and b) a ladder diagram (do not sim-
page 259

plify).

X = A ⋅ B ⋅ C + (C + B)

ans. X = B ⋅ (A ⋅ C + C)

10. a) Construct a truth table for the following problem.


i) there are three buttons A, B, C.
ii) the output is on if any two buttons are pushed.
iii) if C is pressed the output will always turn on.
b) Develop a Boolean expression.
c) Develop a Boolean expression using a Karnaugh map.

ans. A B C out
C+A⋅B
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1 AB AB AB AB
1 0 0 0 C
1 1 1 1
1 0 1 1
1 1 0 1 1 0 0 0
C
1 1 1 1

11. a) Given the following truth table, show the Boolean combinations that would give a result of
1.
page 260

A B C D Result
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 0
0 1 1 1 1
1 0 0 0 1
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
b) Write the results in a) in a Boolean equation.
c) Simplify the Boolean equation in b)

ANS.
ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD + ABCD

A ⋅ ( BCD + BCD + BCD + BCD ) + A ⋅ ( BCD + BCD + BCD + BCD )

A ⋅ ( BCD ) + A ⋅ ( BCD ) + BCD + BCD + BCD

B ⋅ ( ACD + ACD ) + BCD + CD ⋅ ( B + B )

B ⋅ ( ACD + ACD ) + BCD + CD

12. Develop the simplest Boolean expression for the Karnaugh map below,
a) graphically.
b) by Boolean Algebra
page 261

AB AB AB AB
CD 1 1
CD 1 1
CD
CD 1 1

ANS.
DA + ACD

ABCD + ABCD + ABCD + ABCD + ABCD + ABCD

ACD + ACD + ACD

AD + ACD

13. Setup the Karnaugh map for the truth table below.

A B C D Result
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
page 262

ANS. AB AB AB AB
CD 1 1 1 1

CD 1 1 0 1

CD 0 0 0 1

CD 0 0 0 1

14. a) Develop the Boolean expression for the circuit below.


b) Simplify the Boolean expression.
c) Draw a simpler circuit for the equation in b).

A
B
C
X
B
A

ANS.
CAB

C
A X
B

A B C
X

15. Is the ladder logic below for,


a) AND
page 263

b) OR
c) both a) and b)
d) none of the above

(ans. a)

16. Simplify the following Boolean equations,

a) (A + B) ⋅ ( A + B)

ans. ( A + B ) ⋅ ( A + B ) = ( AB ) ( AB ) = 0

b) ABCD + ABCD + ABCD + ABCD

ans. ABCD + ABCD + ABCD + ABCD = BCD + ABD = B ( CD + AD )

17. Simplify the following boolean equations

a) A ( B + AB ) b) A ( B + AB )

c) A ( B + AB ) d) A ( B + AB )

18. Convert the following ladder logic to a karnaugh map.

A C A X

B D
page 264

ans.
A B C D X

0 0 0 0 0 CD CD CD CD
0 0 0 1 0 0 1 0 0
0 0 1 0 0 AB
0 0 1 1 0 0 1 0 0
AB
0 1 0 0 0
0 1 0 1 0 0 0 0 0
AB
0 1 1 0 1
0 1 1 1 1 1 1 0 0
AB
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0

19. Simplify the following and implement the original and simplified equations with gates and
ladder logic.

A + (B + C + D) ⋅ (B + C) + A ⋅ B ⋅ (C + D)

ans. A + (B + C + D) ⋅ (B + C) + A ⋅ B ⋅ (C + D)

A ⋅ (1 + B ⋅ (C + D)) + (B + C + D) ⋅ B + (B + C + D) ⋅ C

A + (C + D) ⋅ B + C

A+C⋅B+D⋅B+C

A+D⋅B+C
page 265

ans.
A+D⋅B+C

B
C
D

A
B

A
C
page 266

B B

C C

C A B

27. Short answer

a) Write the simplest Boolean equation for the karnaugh map below,

CD CD CD CD
AB 1 0 0 1

AB 0 0 0 0

AB 0 0 0 0

AB 0 1 1 0

28. Given a system that is described with the following equation,


page 267

X = A + (B ⋅ (A + C) + C) + A ⋅ B ⋅ (D + E)
a) Simplify the equation using Boolean Algebra.
b) Implement the original and then the simplified equation with a digital circuit.
c) Implement the original and then the simplified equation in ladder logic.
d) Implement the simplified equation in a Basic Stamp program. Assume the inputs and outputs
are on pins A=1, B=2, C=3, D=4, E=5, X=6)

ans. a) X = A + ( B ⋅ (A + C) + C) + A ⋅ B ⋅ (D + E)
X = A + (B ⋅ A + B ⋅ C + C) + A ⋅ B ⋅ D + A ⋅ B ⋅ E

X = A ⋅ (1 + B ⋅ D + B ⋅ E) + B ⋅ A + C ⋅ (B + 1)

X = A+B⋅A+C
ans. b) ABCD E

X
page 268

X
ans. c) A

B A

A B D

A X

B A

ans. d) input 1 ‘input A


input 2 ‘input B
input 3 ‘input C
input 4 ‘input D
input 5 ‘input E
output 6 ‘output X
loop:
low 6
if (in1=1) or (in2=1 or in1=0) or (in3=1) then on
goto loop
on:
high 6
goto loop

29. Given the truth table below find the most efficient ladder logic to implement it. Use a struc-
tured technique such as Boolean algebra or Karnaugh maps.
page 269

A B C D X Y

0 0 0 0 0 0
0 0 0 1 0 1
0 0 1 0 0 0
0 0 1 1 0 0
0 1 0 0 0 0
0 1 0 1 0 0
0 1 1 0 0 1
0 1 1 1 0 1
1 0 0 0 1 0
1 0 0 1 1 1
1 0 1 0 0 0
1 0 1 1 0 0
1 1 0 0 1 0
1 1 0 1 1 0
1 1 1 0 0 1
1 1 1 1 0 1

ans. FOR X FOR Y


CD CD
00 01 11 10 00 01 11 10

00 0 0 0 0 00 0 1 0 0
AB 01 0 0 0 0 AB 01 0 0 1 1
11 1 1 0 0 11 0 0 1 1
10 1 1 0 0 10 0 1 0 0

X = A⋅C Y = B⋅C⋅D+B⋅C

A C X

B C D
Y

B C
page 270

30. For the following Boolean equation,

X = A + B ( A + CB + DAC ) + ABCD
a) Write out the logic for the unsimplified equation.
b) Simplify the equation.
c) Write out the ladder logic for the simplified equation.

31. Use a karnaugh map to simplify the following truth table, and implement it in ladder logic.

A B C D X

0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1

32. Convert the following Boolean equation to the simplest possible ladder logic.

X = A ⋅ (A + A ⋅ B)
page 271

21. NUMBERING

21.1 INTRODUCTION

• We are familiar with numbers based on units of 10, a result of our 10 fingers. But, other number
bases are possible.

• When using digital systems, we will use a variety of numbering systems (other than in units of
10).

• With computers, number bases that are multiples of 2 are favored.


base 2 - binary
base 8 - octal
base 16 - hexadecimal

• For each base we count as usual, but the numbers stop at some value, then a more significant
digit is added.

decimal binary octal hexadecimal


0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7 Note: As with all numbering systems
8 1000 10 8
9 1001 11 9 most significant digits are at left,
10 1010 12 a least significant digits are at right.
11 1011 13 b
12 1100 14 c
13 1101 15 d
14 1110 16 e
15 1111 17 f
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
page 272

21.2 DATA VALUES

21.2.1 Binary

• Binary is best used in computers because signals are ON/OFF which is well suited to the two
binary digits.

• Converting between number systems can be done by looking at digit magnitude.

26 = 64 25 = 32 24 = 16 23 = 8 22 = 4 21 = 2 20 = 1

1110001

A binary to decimal
conversion 64
32
16
1
113

• Conversion can also be done between systems by division.

• For division use remainders.


page 273

e.g., convert 932 in decimal (base 10) to a binary number (base 2)

932 0
--------- = 466.0
for binary 2
466 0
--------- = 233.0
2
233 1
--------- = 116.5
2
116 0
--------- = 58.0
2
58 0
------ = 29.0
2
29 1
------ = 14.5
2
14 0
------ = 7.0 1110100100
2
7--- 1
= 3.5
2
3--- 1
= 1.5
2
1--- 1
= 0.5
2

multiply places after decimal by division


base, in this case it is 2 because of the binary.
* This method works for other number bases also, the divisor and multipliers
should be changed to the new number bases.

• Convert the following numbers to/from binary


page 274

base 10 base 2

54,321

110000101101

• Binary bytes and words are shown below.

BYTE WORD
MSB LSB MSB LSB

0110 1011 0110 1011 0100 0010


most least
significant significant
byte byte

21.2.2 Boolean Operations

• In most discrete systems the inputs and outputs (I/O) are either on or off. This is a binary state
that will be represented with,

1 = on
0 = off

• Because there are many inputs and outputs, these can be grouped (for convenience) into binary
numbers.

• Consider an application of binary numbers. There are three motors M1, M2 and M3
100 = Motor 1 is the only one on
page 275

111 = All three motors are on


in total there are 2n or 23 possible combinations of motors on.

• The most common Binary operations are,

Name Example Result

AND 0010 * 1010 0010


OR 0010 + 1010 1010
NOT 0010 1101
EOR 0010 eor 1010 1000
NAND 0010 * 1010 1101
shift left 111000 110001 (other results are possible)
shift right 111000 011100 (other results are possible)
etc.
*There are many other operations in addition to this list.
** These operations and the others can be useful for some complicated operations

21.2.3 Binary Mathematics

• These include standard logic forms such as,


- and/or/add, etc.
- compliments

• Negative numbers are a particular problem with binary numbers. As a result there are two com-
mon numbering systems use,
- signed binary - the most significant bit (MSB) of the binary number is used to indicate
positive/negative
- 2s compliment - negative numbers are represented by complimenting the binary number
and then adding 1.

• Signed binary numbers are easy to understand, but much harder to work with when doing calcu-
lations.

• An example of 2s compliments are given below,


page 276

decimal binary byte METHOD FOR MAKING A NEGATIVE NUMBER

2 00000010 1. write the binary number for the positive


1 00000001
for -30 we write 30 = 00011110
0 00000000
-1 11111111 2. Invert (compliment) the number
-2 11111110
00011110 becomes 11100001

3. Add 1
11100001 + 00000001 = 11100010

• When adding 2s compliment numbers, additional operations are not needed to deal with nega-
tive numbers. Consider the examples below,

00000001 = 1 00000001 = 1 00000010 = 2


+ 11111111 = -1 + 11111110 = -2 + 11111111 = -1
C+00000000 = 0 11111111 = -1 C+00000001 = -1

ignore the carry bits Note: Normally the carry bit is ignored during the oper-
ation, but some additional logic is required to make
sure that the number has not ‘overflowed’ and moved
outside of the range of the numbers. Here the 2s com-
pliment byte can have values from -128 to 127.

21.2.4 BCD (Binary Coded Decimal)

• Each digit is encoded in 4 bits

1263 BCD
Note: this example shows four digits
in two bytes. The hex values
would also be 1263.
0001 0010 0110 0011 decimal

• This numbering system makes poor use of the digits, but is easier to convert to/from base 10
page 277

numbers. For the two bytes above the maximum numbers possible are from 0-9999 in BCD,
but 0-64285 in binary.

• Convert the BCD number below to a decimal number,

0110 0010 0111 1001

• Convert the following binary number to a BCD number,

0100 1011

21.2.5 Number Conversions

• Convert the following binary number to a Hexadecimal value,

0100 1011
page 278

• Convert the following binary number to a octal,

0100 1011

21.2.6 ASCII (American Standard Code for Information Interchange)

• While numbers are well suited binary, characters don’t naturally correspond to numbers. To
overcome this a standard set of characters and controls were assigned to numbers. As a result,
the letter ‘A’ is readily recognized by most computers world-wide when they see the number
65.
page 279

hexadecimal

hexadecimal
decimal

decimal
ASCII

ASCII
binary

binary
0 0 00000000 NUL 32 20 00100000 space
1 1 00000001 SOH 33 21 00100001 !
2 2 00000010 STX 34 22 00100010 “
3 3 00000011 ETX 35 23 00100011 #
4 4 00000100 EOT 36 24 00100100 $
5 5 00000101 ENQ 37 25 00100101 %
6 6 00000110 ACK 38 26 00100110 &
7 7 00000111 BEL 39 27 00100111 ‘
8 8 00001000 BS 40 28 00101000 (
9 9 00001001 HT 41 29 00101001 )
10 A 00001010 LF 42 2A 00101010 *
11 B 00001011 VT 43 2B 00101011 +
12 C 00001100 FF 44 2C 00101100 ,
13 D 00001101 CR 45 2D 00101101 -
14 E 00001110 S0 46 2E 00101110 .
15 F 00001111 S1 47 2F 00101111 /
16 10 00010000 DLE 48 30 00110000 0
17 11 00010001 DC1 49 31 00110001 1
18 12 00010010 DC2 50 32 00110010 2
19 13 00010011 DC3 51 33 00110011 3
20 14 00010100 DC4 52 34 00110100 4
21 15 00010101 NAK 53 35 00110101 5
22 16 00010110 SYN 54 36 00110110 6
23 17 00010111 ETB 55 37 00110111 7
24 18 00011000 CAN 56 38 00111000 8
25 19 00011001 EM 57 39 00111001 9
26 1A 00011010 SUB 58 3A 00111010 :
27 1B 00011011 ESC 59 3B 00111011 ;
28 1C 00011100 FS 60 3C 00111100 <
29 1D 00011101 GS 61 3D 00111101 =
30 1E 00011110 RS 62 3E 00111110 >
31 1F 00011111 US 63 3F 00111111 ?
page 280

hexadecimal

hexadecimal
decimal

decimal
ASCII

ASCII
binary

binary
64 40 01000000 @ 96 60 01100000 ‘
65 41 01000001 A 97 61 01100001 a
66 42 01000010 B 98 62 01100010 b
67 43 01000011 C 99 63 01100011 c
68 44 01000100 D 100 64 01100100 d
69 45 01000101 E 101 65 01100101 e
70 46 01000110 F 102 66 01100110 f
71 47 01000111 G 103 67 01100111 g
72 48 01001000 H 104 68 01101000 h
73 49 01001001 I 105 69 01101001 i
74 4A 01001010 J 106 6A 01101010 j
75 4B 01001011 K 107 6B 01101011 k
76 4C 01001100 L 108 6C 01101100 l
77 4D 01001101 M 109 6D 01101101 m
78 4E 01001110 N 110 6E 01101110 n
79 4F 01001111 O 111 6F 01101111 o
80 50 01010000 P 112 70 01110000 p
81 51 01010001 Q 113 71 01110001 q
82 52 01010010 R 114 72 01110010 r
83 53 01010011 S 115 73 01110011 s
84 54 01010100 T 116 74 01110100 t
85 55 01010101 U 117 75 01110101 u
86 56 01010110 V 118 76 01110110 v
87 57 01010111 W 119 77 01110111 w
88 58 01011000 X 120 78 01111000 x
89 59 01011001 Y 121 79 01111001 y
90 5A 01011010 Z 122 7A 01111010 z
91 5B 01011011 [ 123 7B 01111011 {
92 5C 01011100 yen 124 7C 01111100 |
93 5D 01011101 ] 125 7D 01111101 }
94 5E 01011110 ^ 126 7E 01111110 r arr.
95 5F 01011111 _ 127 7F 01111111 l arr.
page 281

e.g. The sequence of numbers below will convert to

65

A W E E T E S T

21.3 DATA CHARACTERIZATION

21.3.1 Parity

• Parity - used to detect errors in data. A parity bit can be added to the data. For example older
IBM PCs store data as bytes, with an extra bit for parity. This allows real-time error checking
of memory.

• Parity can be even or odd.

• The odd parity bit is true if there are an odd number of bits on in a binary number. On the other
hand the Even parity is set if there are an even number of true bits.

data parity
bits bit
e.g.
Odd Parity 10101110 1
10111000 0

Even Parity: 00101010 0


10111101 1

• Convert the decimal value below to a binary byte, and then determine the odd parity bit,
page 282

97

21.3.2 Gray Code

• A scheme to send binary numbers, but encoded to be noise resistant.

• The concept is that as the binary number counts up or down, only one bit changes at a time. Thus
making it easier to detect erroneous bit changes.

ASIDE: When the signal level in a wire rises or drops, it induces a magnetic pulse that excites a
signal in other nearby lines. This phenomenon is known as ‘cross-talk’. This signal is often too
small to be noticed, but several simultaneous changes, coupled with background noise could
result in erroneous values.

e.g. GRAY CODE sequence dec gray code

0 0000
1 0001
2 0011
3 0010
4 0110
5 0111
6 0101
7 0100
8 1100
9 1101
10 1111
11 1110
12 1010
13 1011
14 1001
15 1000
page 283

21.3.3 Checksums

• Parity bits work well when checking a small number of bits, but when the sequence becomes
longer a checksum will help detect transmission errors.

• Basically this is a sum of values.

DATA CHECKSUM
124 505
43
255
9
27
47

21.4 PRACTICE PROBLEMS

3.
a) Represent the following decimal value thumbwheel input as a Binary Coded Decimal
(BCD) and a Hexadecimal Value (without using a calculator).

3532
i) BCD
ii) Hexadecimal

b) What is the corresponding decimal value of the following BCD

1001111010011011

(ans. a. 3532 = 0011 0101 0011 0010 = DCC, b. the number is not a valid BCD)

5. TRUE or FALSE -- A Word is 3 nibbles.

(ans. false)

20. Convert the following from binary to decimal, hexadecimal, BCD and octal.
page 284

a) 101101
b) 11011011
c) 10000000001
d) 0010110110101

21. Convert the following from decimal to binary, hexadecimal, BCD and octal.

a) 1
b) 17
c) 20456
d) -10

22. Convert the following from hexadecimal to binary, decimal, BCD and octal.

a) 1
b) 17
c) ABC
d) -A

23. Convert the following from BCD to binary, decimal, hexadecimal and octal.

a) 1001
b) 1001 0011
c) 0011 0110 0001
d) 0000 0101 0111 0100

24. Convert the following from octal to binary, decimal, hexadecimal and BCD.
page 285

a) 7
b) 17
c) 777
d) 32634

25. Why are binary, octal and hexadecimal used for computer applications?

26. Add/subtract/multiply/divide the following numbers.

a) binary 101101101 + 01010101111011 i) octal 123 - 777

b) hexadecimal 101 + ABC j) 2s complement bytes 10111011 + 00000011


c) octal 123 + 777 k) 2s complement bytes 00111011 + 00000011

d) binary 110110111 - 0101111 l) binary 101101101 * 10101


e) hexadecimal ABC - 123 m) octal 123 * 777

f) octal 777 - 123 n) octal 777 / 123


g) binary 0101111 - 110110111 o) binary 101101101 / 10101

h) hexadecimal 123-ABC p) hexadecimal ABC / 123

27. Short answer

b) What are the specific purpose for Gray code and parity?
.
ans. #1a) ABD + ABD

ans. #1b) Both of these are coding schemes designed to increase immunity to noise.
A parity bit can be used to check for a changed bit in a byte. Gray code can
be used to check for a value error in a stream of continuous values.
page 286

22. EVENT BASED LOGIC

• These devices will be set based on previous conditions in the PLC.

22.1 INTRODUCTION

• Typical events in a PLC include,


- first scan of the PLC
- time since an input turned on/off
- count of events
- etc.

22.2 TIMERS, COUNTERS, FLIP-FLOPS, LATCHES

• There are some devices, and concepts that are Temporal. This means that they keep track of
events over time, as opposed to conditional logic that decides based on instantaneous condi-
tions.

e.g. A Start Push Button


Push Button
+V
Device
On/Off

Push Button

Device (Conditional Control)

Device (Event Control)


time

• Controls that have states, or time dependence will require temporal controls (also known as
sequential)

• Some devices that are temporal are

Flip-Flops - these can be latched on or off.


page 287

Latches - Will stay on until reset (Similar to flip-flops)


Counters - Keeps a count of events
Timers - Allows inputs and outputs to be delayed, or prolonged be a known amount.

22.2.1 Latches

- Will stay on when set, until unlatched (even through power loss)

A D
L

A C

B D
U
page 288

Timing Diagram event too short to be noticed (aliasing)

These lines indicate PLC input/output refresh times. At this time


all of the outputs are updated, and all of the inputs are read.
Notice that some inputs can be ignored if at the wrong time,
and there can be a delay between a change in input, and a change
in output.

The space between the lines is the scan time for the ladder logic.
The spaces may vary if different parts of the ladder diagram are
executed each time through the ladder (as with state space code).
The space is a function of the speed of the PLC, and the number of
Ladder logic elements in the program.

• Assuming that the PLC is much faster than the fastest event (i.e. no aliasing), then we can
approximate the timing diagram above with a simpler form.

D
page 289

• As an example consider the ladder logic for a SLC-150,

002 011

002 012
L

003 012
U

002 013

003 013

002

003

011

012

013

• In most PLCs these will keep their last state even when the PLC is turned off, and back on.

• Write a short ladder logic program that will,


page 290

Alternate between two outputs continuously using latches. ie, each scan one will turn off
and the other will turn on.

22.2.2 Flip-Flops

• There are many type, but one of the best known is the SR (Set-Reset) Flip-Flop.
page 291

S Q

R Q

Some PLCs use Flip-Flops instead of latches. (not in A-B PLCs)

22.2.3 Timers

• We use timers to do some or all of,


- Delay turning on
- Delay turning off
- Accumulate time passed

on-delay off-delay

Retentive RTO RTF

Nonretentive TON TOF


page 292

e.g. An On Timer (TON)

TON
A Timer T4:0
Time Base 1.0 (DN)
Preset 4
Accum. 0 (EN)

T4:0 EN
T4:0 DN

4
3 2
0
T4:0 Accum.

0 3 6 9 13 14 17 19
page 293

e.g. A Retentive On Timer (RTO)

RTO
A Timer T4:0
Time Base 1.0 (DN)
Preset 4
Accum. 0 (EN)

T4:0 EN
T4:0 DN

4
3
0
T4:0 Accum.

0 3 6 9 10 14 17 19
page 294

e.g. An Off Timer (TOF)

TOF
A Timer T4:0
Time Base 0.01 (DN)
Preset 350
Accum. 0 (EN)

T4:0 EN
T4:0 DN

3.5
3
0
T4:0 Accum.

0 3 6 9.5 10 16 18 20
page 295

e.g. A Retentive Off Timer (RTF)

RTF
A Timer T4:0
Time Base 0.01 (DN)
Preset 350
Accum. 0 (EN)

T4:0 EN
T4:0 DN

T4:0 Accum.

0 3 6 10 16 18 20

• When using timers (especially retentive) we must reset values when done. The (RES) instruction
does this.

• The timers also have timer timing bits that indicate when the accumulator value is changing.

• Consider the example below, Write out the values for the accumulator, enable, timer timing and
the done bits.
page 296

e.g. An Allen-Bradley PLC-5 Retentive Timer ON

RTO
A Timer T4:0
Time Base 1.0 (DN)
Preset 10
Accum. 1 (EN)

T4:0 EN

T4:0 TT

T4:0 DN

T4:0 Accum.

0 3 6 9 14 17 18 20

SLC 150 901


A
RTO
PR 0100

• Repeat the last example for the timer below.


page 297

e.g. An Allen-Bradley PLC-5 Timer Off Delay

TOF
A Timer T4:1
Time Base .01 (EN)
Preset 50
Accum. 0 (DN)

T4:1 EN
T4:1 TT
T4:1 DN

T4:1 Accum.

0 15 45 150 200 225

SLC 150 902


A
TOF
PR 0050

• Consider the example of the SLC timers given below,


page 298

001 901
TON
PR 0040

001 902
RTO
PR 0040

001 903
TOF
PR 0040

001 904
RTF
PR 0040

901 011

002 901
RST

002 902
RST

002 903
RST

002 904
RST
page 299

001

002

901

902

903

904

011

time
0 5 10 15 20 25 30 35 40 (sec)

• As an example,

write a short ladder logic program that will turn a light (LA) on 10 seconds after a button
(PB) is pushed. A second light (LB) should be on while the button is pushed and then
turn off 10 seconds after it has been released.
page 300

• When more than one event should happen in a sequence, timers can be cascaded. This means
that the end of the first timer starts the next.

• As an example,

write a short ladder logic program that will turn a light on/off every 10 seconds.

22.2.4 Counters

• Count up/count down counters will track input events.


page 301

• An allen Bradley PLC-5 counter is shown below


a count up counter
CTU
A counter C5:0 (EN)
Preset 4
Accum. 2 (DN)

1. Each time A turns on (then off) the accumulated value increases


(here from 2to3, then 3to4, and so on)
2. When the accumulated value reaches the preset value the ‘DN’
flag is set.
C5:0

DN
3. We can set the accumulated value to zero with.
C5:0
RES

• Count down counters are similar but can be used for convenience.

• Consider the example below for a SLC-150,


page 302

001 901
CTU
PR 0003
002 901
CTD
PR 0003
003 901
RST

901 111

001

002

003

901

111

• Write a simple program that will,


page 303

count 5 button presses and then turn on a light. After ten button pushes the light will be
turned off.

22.3 PROGRAM DESIGN METHODS

• NOTE: these are structured design methods - although many of the design activities are obvious,
by following the same steps, others can understand what you have done, and others will get
similar results when they solve a similar problem. This is a simple start, and we will advance to
significant design techniques later.

22.3.1 Process Sequence Bits

• A simple process will typically go through clear steps. Each step should follow the other, and
when done the process goes back to the beginning.

• The general steps to this method are,


page 304

1. Understand the process


2. Write the steps of operation and give each a number
3. For each step assign a bit
4. Write the ladder logic to turn the bits on/off as the process moves through its states.

• Consider the problem below.

a flag raiser that will go up when an up button is pushed, and down when a down button is
pushed, both pushbuttons are momentary. There are limit switches at the top and bot-
tom to stop the flag pole. When turned on at first the flag should be lowered until it is at
the bottom of the pole.
page 305

22.3.2 Timing Diagrams

• By writing a timing diagram, the sequence of steps in a program can be obvious.

• The general steps to this method are,


1. Understand the process
2. Identify the outputs that are time dependant
3. For each step assign a timer
4. Write the ladder logic to turn the outputs on/off as time progresses.

• Consider the problem below.

A handicap door opener has a button that will open two doors. When the button is pushed
(momentatrily) the first door will start to open immediately, the second door will start
to open 2 seconds later. The first door power will stay open for a total of 10 seconds,
and the second door power will stay on for 14 seconds. Use a timing diagram to design
the ladder logic.
page 306

22.4 DESIGN CASES

22.4.1 Counters And Timers

Part A - Develop the ladder logic that will turn on an output light, 15 seconds after switch A has
been turned on.

Part B - Develop the ladder logic that will turn on a light, after switch A has been closed 10 times.
Push button B will reset the counters.

A TON T4:0
Time base: 1.0
Preset 15

T4:0/DN
Light

A CTU C5:0
Preset 10
Accum. 0
C5:0/DN
Light

B
C5:0 RES

22.4.2 More Timers And Counters

Develop a program that will latch on an output ‘B’ 20 seconds after input A has been turned on.
After ‘A’ is pushed, there will be a 10 second delay until ‘A’ can have any effect again. After
page 307

‘A’ has been pushed 3 times, ‘B’ will be turned off.

A
On L

On TON T4:0
Time base: 1.0
Preset 20
T4:0/DN
Light L

T4:0/DN TON T4:1


Time base: 1.0
Preset 10
T4:1/DN
On U

On CTU C5:0
Preset 3
Accum. 0
C5:0/DN
Light U

22.4.3 Oscillator

• An oscillator will be designed that will turn on for 1 seconds and off for 1.5 seconds continu-
ously.
page 308

22.4.4 More Timers

• Design ladder logic that allows an RTO to behave like a TON.

22.4.5 Cascaded Timers

• Design ladder logic that uses normal timers to measure times of 5.0 days.

22.4.6 Deadman Switch

A motor will be controlled by two switches. The Go switch will start the motor and the Stop
switch will stop it. If the Stop switch was used to stop the motor, the Go switch must be thrown
twice to start the motor. When the motor is active a light should be turned on. The Stop switch
will be wired as normally closed.
page 309

Motor Stop
C5:0
RES

Go Motor CTU C5:0


Preset 2
Accum. 1

C5:0/DN Stop
Motor

Motor
Light

Consider:
- what will happen if stop is pushed and the motor is not running?

22.4.7 Conveyor

A conveyor is run by switching on or off a motor. We are positioning parts on the conveyor with
an optical detector. When the optical sensor goes on, we want to wait 1.5 seconds, and then
stop the conveyor. After a delay of 2 seconds the conveyor will start again. We need to use a
start and stop button - a light should be on when the system is active.
page 310

Go Stop
Light

Light

Part Detect TON T4:0


Time base: 0.01
Preset 150

T4:0/DN TON T4:1


Time base: 1.0
Preset 2

T4:0/DN Light
Motor

T4:1/DN
T4:0 RES

T4:1/DN
T4:1 RES

- what is assumed about part arrival and departure?

22.4.8 Accept/Reject Sorting

For the conveyor in the last case we will add a sorting system. Gages have been attached that indi-
cate good or bad. If the part is good, it continues on. If the part is bad, we do not want to delay
for 2 seconds, but instead actuate a pneumatic cylinder.
page 311

Go Stop
Light

Light

Part Detect TON T4:0


Time base: 0.01
Preset 150

T4:0/DN Part Good TON T4:1


Time base: 1.0
Preset 2

T4:0/DN Part Good TON T4:2


Time base: 0.01
Preset 50

T4:1/EN Light
Motor

T4:2/EN
Cylinder

T4:1/DN
T4:0 RES
T4:2/DN

T4:1/DN
T4:1 RES
T4:2/DN
T4:2 RES

22.4.9 Shear Press

The basic requirements are,


1. A toggle start switch (TS1) and a limit switch on a safety gate (LS1) must both be on before a
page 312

solenoid (SOL1) can be energized to extend a stamping cylinder to the top of a part.
2. While the stamping solenoid is energized, it must remain energized until a limit switch (LS2) is
activated. This second limit switch indicates the end of a stroke. At this point the solenoid
should be de-energized, thus retracting the cylinder.
3. When the cylinder is fully retracted a limit switch (LS3) is activated. The cycle may not begin
again until this limit switch is active.
4. A cycle counter should also be included to allow counts of parts produced. When this value
exceeds 5000 the machine should shut down and a light lit up.
5. A safety check should be included. If the cylinder solenoid has been on for more than 5 sec-
onds, it suggests that the cylinder is jammed or the machine has a fault. If this is the case, the
machine should be shut down and a maintenance light turned on.

TS1 LS1 LS3 C5:0/DN


SOL1 L

LS2
SOL1 U

T4:0/DN

SOL1 CTU C5:0


Preset 5000
Accum. 0

SOL1 RTO T4:0


Time base: 1.0
Preset 5

T4:0/DN
LIGHT L

C5:0/DN

RESET
T4:0 RES

- what do we need to do when the machine is reset?


page 313

22.4.10 Actuator Failure

• Consider the following.

We are using a pneumatic cylinder in a process. The cylinder can become stuck, and we
need to detect this. Proximity sensors are added to both endpoints of the cylinders travel
to indicate when it has reached the end of motion. If the cylinder takes more than 2 sec-
onds to complete a motion this will indicate a problem. When this occurs the machine
should be shut down and a light turned on. Develop ladder logic that will cycle the cylin-
der in and out repeatedly, and watch for failure.

22.4.11 Palm Button Detection

• Consider the following.


page 314

In dangerous processes it is common to use two palm buttons that require a operator to use
both hands to start a process (this keeps hands out of presses, etc.). To develop this there
are two inputs that must be turned on within 0.25s of each other before a machine cycle
may begin.

22.5 PRACTICE PROBLEMS

1 Develop the ladder logic that will turn on an output light (201), 15 seconds after switch A (001)
has been turned on.
page 315

ANS.
001
701

701

TON
701 901
PR 1500

901 201

2. Develop the ladder logic that will turn on a light (201), after switch A (001) has been closed 10
times. Push button B (002) will reset the counters.

ANS.
002
901
RES

CTU
001 901
PR 10

901 201

3. Develop a program that will latch on an output B (201), 20 seconds after input A (001) has been
turned on. The timer will continue to cycle up to 20 seconds, and reset itself, until input A has
been turned off. After the third time the timer has timed to 20 seconds, the output B will be
unlatched.
page 316

ANS.
TON
001 901
PR 2000

TON
901 902
PR 2000

901 201
L

CTU
901 903
PR 3

903 201
U

4. Using the status memory locations, write a program that will flash a light for the first 15 sec-
onds after it has been turned on. The light should flash once a second.
page 317

ANS.

868 RTF
901
PR 1500

901 RTO
902
PR 50

902 RTO
903
PR 50

903 902
RES

903 903
RES

902 901 011

5. A motor will be connected to a PLC and controlled by two switches. The GO switch will start
the motor, and the STOP switch will stop it. If the motor is going, and the GO switch is thrown,
this will also stop the motor. If the STOP switch was used to stop the motor, the GO switch must
be thrown twice to start the motor. When the motor is running, a light should be turned on (a small
lamp will be provided).

8. For the ladder diagram below, what does the program do? (Note: the keep is equivalent to an S-
R flip-flop, in other words S will latch the value on, and R will unlatch the value). Note that 200
and 210 are lights and 202 is a motor. 100, 102 and 104 are input push buttons.
page 318

100
S keep
200

102
R

200 104 202

100 210

102

104

(ans. this is a motor controller. 100 is a start button, and 102 is a stop button. Light 200 will indi-
cate when the motor is on. Light 210 will indicate when either start or stop is pushed, or the emer-
gency button is not pushed. The motor 202 will run if the start button has been pushed and the
normally closed stop switch is not pushed).

9. Counters are used to count events or occurrences of inputs when a transition from OFF-to-ON
occurs, which implies that they are ________________________ triggered.

(ans. positive edge)

10. The address for a memory location that indicates when a PLC has just been turned on is
___________________.

(ans. 868 for SLC-150)

11. We are developing a safety system (using a PLC-5) for a large industrial press. The press is
activated by turning on the compressor power relay (R, connected to O013/05). After R has
been on for 30 seconds the press can be activated to move (P connected to O013/06). The delay
is needed for pressure to build up. After the press has been activated (with P) the system must
be shut down (R and P off), and then the cycle may begin again. For safety, there is a sensor
that detects when a worker is inside the press (S, connected to I011/02), which must be off
page 319

before the press can be activated. There is also a button that must be pushed 5 times (B, con-
nected to I011/01) before the press cycle can begin. If at any time the worker enters the press
(and S becomes active) the press will be shut down (P and R turned off). Develop the state
transition diagram, and then ladder logic for the states. State all assumptions, and show all
work.

12. Given the following timing diagram, draw the done bits for all four fundamental timer types.
Assume all start with an accumulated value of zero, and have a preset of 1.5 seconds.

input

TON

RTO

TOF

RTF

sec
0 1 2 3 4 5 6 7
page 320

ans.
input

TON

RTO

TOF

RTF

sec
0 1 2 3 4 5 6 7

13. Write ladder logic that will give the following timing diagram for ‘B’ after input ‘A’ is pushed.
After ‘A’ is pushed any changes in the state of ‘A’ will be ignored.

true

false t(sec)
0 2 5 6 8 9
page 321

23. SEQUENTIAL LOGIC DESIGN

• This is for systems that move between different ‘modes’ of operation.

• These techniques allow different levels of design sophistication.

• In general the techniques and tools can be selected as shown below.

sequential
problem
simple/small complex/large

single process multiple


processes
no clear steps buffered (waiting)
STATE DIAGRAM state triggers
an orderly SCRIPTS PETRI NET
process with steps performance
short important no waiting with
FLOW CHART development single states
time

BLOCK LOGIC EQUATIONS SFC/GRAFSET

23.1 SCRIPTS

• Another method that can be used to explore a state based program is a script. Another way to
describe this is “what is happening, what started it and what will stop it?”

• The general hierarchy for a script is below,


page 322

The output/state/memory [name]....


.....is active.....
......is stopped.....
..... stays on after.....
.....turns off after.....
.....is followed by output/state/memory [name] when.....

.... delays turning on/off for [time] after input/state/memory [name] turns on/off
..... while input/state/memory [name] is on/off
..... after input/state/memory [name] turns on/off

• After we get a process description it must be rewritten as a script. Care is needed to check for
consistency.

The output [press advance] stays on after activated. This follows output [press idle
light], it is activated by input [both hand buttons pushed]. It is stopped by [bottom
limit hit], it is followed by output [press retract]. Or, it is stopped by input [E-stop
or gate open], it is followed by output [press stop light].

The output [press retract] stays on after activated. This follows output [press advance]
or output [press idle light] and [start]. It is stopped by input [top limit], it is fol-
lowed by output [press advance]. It is also stopped by [E-stop].

ETC......

• This can be put into ladder logic. (clearly this logic is not complete and extra work is needed
make it ready for the PLC)
page 323

press hand hand


idle light button A button B press
L advance

press idle
light
U
press bottom
advance limit press
retract
L

press
advance
U
press E-stop
advance press stop
light
L

press
advance
gate U
closed

• Implemented for an Allen Bradley PLC it might look like.


page 324

first scan
S2:1/14 press idle light
L O:000/00

press advance
U O:000/01

press retract
U O:000/02

press stop
U O:000/03
Start top limit
I:000/01 I:000/02 press idle light
U O:000/00

press advance
ETC.............
L O:000/01

• General rules for scripting are,


1. At least one sentence is needed for at least each output.
2. The list of conditions should refer to other conditions.
3. The script should refer to actual inputs/outputs, memory locations or state names.

• This method is not rigorous and can be inadequate for many designs.

• Use the method to design a parking gate controller.


page 325

light - the gate will be raised by one output


keycard entry
and lowered by another. If the gate
gets stuck an over current detector
will make a PLC input true. If this
is the case the gate should reverse
and the light should be turned on
gate indefinitely.
- if a valid keycard is entered a PLC
input will be true. The gate is to
cars enter/leave car detector rise and stay open for 10 seconds.
- when a car is over the car detector a
PLC input will go true. The gate is
to open while this detector is
active. If it is active for more that
30 seconds the light should also
turn on until the gate closes.

23.2 FLOW CHARTS

• Good when the PLC only does one thing at a time in a predictable sequence.

• Basically, we can follow a flowchart one step at a time. Connecting lines indicate the sequences,
and the shapes indicate the action/function.
page 326

Start/Stop

Operation

Decision

I/O

Disk/Storage

Subroutine

• The real advantage is in modeling the process in an orderly manner.


page 327

START

Reset all values off

no
start button pushed?

yes

Open inlet valve


Close outlet valve

yes
Open outlet valve
Is tank full?
Close inlet valve

no

stop button pushed?


yes

no

• General rules for putting these together are,


- determine what the major actions are, these become the boxes.
- determine what sequence the actions normally follow, this determines the lines between
elements.
- determine where the sequence may change, these become the decision diamonds.

• The flowchart from the previous example can be converted to ladder logic. The first step is to
name each state. From there the states can be converted to ladder logic using MCR blocks.
page 328

ASIDE: We will use MCR instructions to implement some of the state based pro-
grams. This allows us to switch off part of the ladder logic. The one significant
note to remember is that any normal outputs (not latches, timers, etc.) will be
FORCED OFF. Unless this is what you want, put the normal outputs outside
MCR blocks.

A
MCR

If A is true then the MCR will cause the ladder in between


to be executed. If A is false it is skipped.

MCR
page 329

STEP 1: Add labels to each block in the flowchart

START

F1
Reset all values off

F2
no
start button pushed?

yes
F3

Open inlet valve


Close outlet valve

F6
F4 yes
Open outlet valve
Is tank full?
Close inlet valve

no

F5
stop button pushed?
yes

no
page 330

STEP 2: Write ladder logic to force the PLC into the first state
first scan
F1
L

F2
U

F3
U

F4
U

F5
U

F6
U

STEP 3: Write ladder logic for each function in the flowchart

F1
MCR

outlet
U

inlet
U

F1
U

F2
L

MCR
page 331

F2
MCR

start
F2
U

F3
L

MCR
F3
MCR

outlet
U

inlet
L

F3
U

F4
L

MCR
page 332

F4
MCR

F4
U

tank full
F6
L

tank full
F5
L

MCR

F5
MCR

F5
U

stop
F6
L

stop
F4
L

MCR
page 333

F6
MCR

outlet
L

inlet
U

F6
U

F2
L

MCR

• For practice,
page 334

Draw a flow chart for cutting the grass, then develop ladder logic for three of the actions/
decisions.
page 335

23.3 STATE BASED MODELLING

• When we have a single sequence of modes we can use state diagrams.

• State diagrams divide a system behavior into discrete states.

• The basic technique uses states and transitions to model the systems.

State 1 State 2

else A else

This diagram could describe the operation of energy efficient lights in a room operated
by two push buttons. State 1 might be lights off and state 2 might be lights on. The
arrows between the states are called transitions and will be followed when the condi-
tions are true. In this case if we were in state 1 and A occurred we would move to
state 2. The ‘else’ loop indicate that a state will stay active if a transition are is not
followed. These are so obvious they are often omitted from state diagrams.

off_pushbutton OR 1 hour timer

power on

Lights off Lights on


on_pushbutton
OR motion detector

• The most essential part of creating state diagrams is identifying states. Some key questions to
ask are,
1. Consider the system,
What does the system do normally?
Does the system behavior change?
Can something change how the system behaves?
Is there a sequence to actions?
2. List ‘modes’ of operation where the system is doing one identifiable activity that will
start and stop. Keep in mind that some activities may just be to wait.
page 336

• Consider a coffee vending machine,

STATES
idle - the machine has no coins and is doing nothing
inserting coins - coins have been entered and the total is displayed
user choose - enough money has been entered and the user is making coffee selection
make coffee - the selected type is being made
service needed - the machine is out of coffee, cups, or another error has occurred

Notes:
1. These states can be subjective, and different designers might pick others.
2. The states are highly specific to the machine.
3. The previous/next states are not part of the states.
4. There is a clean difference between states.

• These states can be organized into a state diagram and transitions can be added.

power up

reset button idle coin inserted inserting


service coins
needed
coin return

no cups cup removed


OR no coffee coin return right amount
OR jam sensor entered

make user
coffee button pushed choose

• Draw a state diagram for the problem below.


page 337

A hydraulic press that will advance when two palm buttons are pushed. Top and bottom
limit switches are used to reverse the advance and stop after a retract. At any time the
hands removed from the palm button will stop an advance and retract the press.

• Draw a state diagram for,

A microwave oven.
page 338

23.3.1 State Diagrams Example

• A Complex Example - In this case we have a set of traffic lights. The lights will remain green in
one direction until a pedestrian cross button is pushed. They will then turn yellow for four sec-
onds and then turn red.

Red L1
Yellow L2
Green L3

North/South *This could be done with simple


Walk Button - S1 if-then logic (conditional)

Red L4
Yellow L5
Green L6
East/West

Walk Button - S2

• First we will describe the system variables. These will vary as the system moves from state to
state. Please note that some of these together can define a state (alone they are not the states).

We have eight items that are ON or OFF


L1
L2 Note that each state will lead
L3 OUTPUTS to a different set of out-
L4 puts. The inputs are often
L5 part, or all of the transi-
L6 tions.
S1
S2 INPUTS

A simple diagram can be drawn to show sequences for the lights

• We can then use outputs, or controlled variables, to indicate system states (you can also think of
page 339

these as modes).

Step 1 : Define the System States and put them (roughly) in sequence

System State
L1 L2 L3 L4 L5 L6 A binary number
0 = light off
1 = light on
State Table
State Description # L1 L2 L3 L4 L5 L6
Green East/West 1 1 0 0 0 0 1
Here the four states
Yellow East/West 2 1 0 0 0 1 0 determine how the 6
Green North/South 3 0 0 1 1 0 0 outputs are switched
Yellow North/South 4 on/off.
0 1 0 1 0 0

• State transitions are determined based on inputs, and how the system changes. These events
cause a change between states. Care must be taken to avoid confusing them with states.

Step 2 : Define State Transition Triggers, and add them to the list of states
Description # L1 L2 L3 L4 L5 L6 transition
Green East/West 1 1 0 0 0 0 1 S1
Yellow East/West 2 1 0 0 0 1 0 delay delay 4 sec
3 0 0 1 1 0 0 4sec
Green North/South
S2
Yellow North/South 4 0 1 0 1 0 0

• The state transition diagram allows us to visually check for continuous loops. In a simple state
diagram multiple transitions may lead to alternate paths.
page 340

Step 3 : Draw the State Transition Diagram


grn. EW pushbutton NS (i.e., 10)
delay 4sec

first scan
yel. EW

yel. NS
delay 4sec

pushbutton EW (i.e. 01) grn. NS

• For the previous traffic light example, add a speed up signal for an emergency vehicle.

A strobe light mounted on fire trucks will cause the lights to change so that the truck
doesn’t need to stop. Modify the state diagram to include this option.

23.3.1.1 - Block Logic Conversion

• The state diagram can be implemented in ladder logic, in this case for a SLC-150. This example
uses states to turn lights on or off. An initial block uses the first scan input ‘868’ to ensure the
first state is state 1. Each state runs a section of ladder logic code in ‘MCR’ blocks to wait for
transitions.
page 341

STATES OUTPUTS INPUTS


701 - state 1 - green E/W 012 - L1 101 - S1
702 - state 2 - yellow E/W 013 - L2 102 - S2
703 - state 3 - green N/S 014 - L3 868 - first scan
704 - state 4 - yellow N/S 015 - L4
016 - L5
112 - L6

RESET THE STATES

MCR
868

701
L

702
U

703
U

704
U

MCR
page 342

TURN ON LIGHTS AS REQUIRED

701 012

702

704 013

703 014

703 015

704

702 016

701 112

FIRST STATE WAIT FOR TRANSITIONS

MCR
701

701
101
U

702
101
L

MCR
page 343

SECOND STATE WAIT FOR TRANSITIONS

702 MCR

901
RTO
PR 0040

901 702
U

901 703
L

901 901
RST

MCR

THIRD STATE WAIT FOR TRANSITIONS

MCR
703

703
102
U

704
102
L

MCR
page 344

FOURTH STATE WAIT FOR TRANSITIONS

704 MCR

902
RTO
PR 0040

902 704
U

902 701
L

902 902
RST

MCR

• Consider the state diagram below and implement it in ladder logic. You should anticipate what
will happen if both A and C are pushed at the same time.

STA STC
B D

A C

STB

first scan
page 345

first scan
L STB

U STA

U STC

STA
MCR

B
U STA

L STB

MCR

STB
MCR

C
U STB

Note: if A and C are true at the same time then C


will have priority. PRIORITIZATION is impor-
L STC
tant when simultaneous branches are possible.
A C
U STB

L STA

MCR
page 346

STC
MCR

D
U STC

L STB

MCR

• For the previous traffic light example, add a speed up signal for an emergency vehicle.

A strobe light mounted on fire trucks will cause the lights to change so that the truck
doesn’t need to stop. Create the ladder logic for the state diagram created previ-
ously.

23.3.1.2 - Single State Equations

• This is the most compact method, but it comes at the cost of robustness.

• We can also model state diagrams with equations. To do this we can continue the traffic light
example from before.
page 347

First, define state variables,


ST1 = state 1 - grn NS
ST2 = state 2 - yel NS
ST3 = state 3 - grn EW
ST4 = state 4 - yel EW
Next, write the state entrance and exit condition equations,

ST1 = ( ST1 + ST4 ⋅ TON 2 ( ST4, 4 ) ) ⋅ ST1 ⋅ S1 ⋅ S2

ST2 = ( ST2 + ST1 ⋅ S1 ⋅ S2 ) ⋅ ST2 ⋅ TON 1 ( ST2, 4 )

ST3 = ( ST3 + ST2 ⋅ TON 1 ( ST2, 4 ) ) ⋅ ST3 ⋅ S1 ⋅ S2

ST4 = ( ST4 + ST3 ⋅ S1 ⋅ S2 ) ⋅ ST4 ⋅ TON 2 ( ST4, 4 )

Now, simplify these for implementation in ladder logic.

ST1 = ( ST1 + ST4 ⋅ TON 2 ( ST4, 4 ) + FS ) ⋅ ( ST1 + S1 + S2 )

ST2 = ( ST2 + ST1 ⋅ S1 ⋅ S2 ) ⋅ ( ST2 + TON 1 ( ST2, 4 ) )

ST3 = ( ST3 + ST2 ⋅ TON 1 ( ST2, 4 ) ) ⋅ ( ST3 + S1 + S2 )

ST4 = ( ST4 + ST3 ⋅ S1 ⋅ S2 ) ⋅ ( ST4 + TON 2 ( ST4, 4 ) )


page 348

ST4 timer on
T4:2
delay 4 sec

ST2 timer on
T4:1
delay 4 sec

TURN ON NEXT STATES FIRST

ST1 ST1
ST1
ST4 T4:2/DN S1

first scan
S2

ST2 ST5 ST2

ST1 S1 S2 T4:1/DN

ST3 ST3
ST3
ST2 T4:1/DN S1

S2

ST4 ST4 ST4

ST3 S1 S2 T4:2/DN
page 349

ST1 L1

ST2

ST4 L2

ST3 L3

ST3 L4

ST4

ST2 L5

ST1 L6

• This method will provide the most compact code, but there are two potential problems. Consider
the example above.
1. In one scan ST2 might turn on, but ST1 is calculated above it in the ladder logic, so it
would not turn off until the next scan - states ST1 and ST2 would both be on for
one scan.
2. If in the second scan the input that caused the transition S1 turns off (it is an input on for
a brief time) then ST1 would not turn off, and both ST1 and ST2 would be on inde-
finately.
3. It is also possible for states that have multiple transitions to go to multiple states.

• The problem of dual states will occur for at least one of the transitions in this system, and must
be tolerable in any system.

• The problem of inputs that are only one cycle long can be solved with a seal in or latch circuit.

• The problem of parallel state branches can occur if transitions are defined to be mutually inde-
pendant. This can be overcome by adding terms to the transition logic that will suppress a tran-
sition when the competing transition is active.

• Consider the state diagram below and implement it in ladder logic. You should anticipate what
will happen if both A and C are pushed at the same time.
page 350

STA STC
B D

A C

STB

first scan

STA = ( STA + STB ⋅ A ) ⋅ STA ⋅ B

STB = ( STB + STA ⋅ B + STC ⋅ D + FS ) ⋅ STB ⋅ A ⋅ STB ⋅ C

STC = ( STC + STB ⋅ C ⋅ A ) ⋅ STC ⋅ D


page 351

STA STA
STA

STB A B

STB STB STB STB

STA B A C

STC D

FS

STC STC
STC

STB C A D

23.3.1.3 - Entry and Exit State Equations

• This method deals updates the logic in a single scan, and only has a problem with competing
transitions.

• This implementation is based upon checking the state activation and deactivation separately.
page 352

First, define state variables,


ST1 = state 1 - grn NS
ST2 = state 2 - yel NS
ST3 = state 3 - grn EW
ST4 = state 4 - yel EW
Next, write the state entrance and exit condition equations,
ST1on = ST1 + ST4 ⋅ DELAY 2 ( ST4, 4 ) + FS
ST1 off = ( ST1 ⋅ S1 ⋅ S2 )
ST2 on = ST2 + ST1 ⋅ S1 ⋅ S2
ST2 off = ( ST2 ⋅ DELAY1 ( ST2, 4 ) )
ST3 on = ST3 + ST2 ⋅ DELAY1 ( ST2, 4 )
ST3 off = ( ST3 ⋅ S1 ⋅ S2 )
ST4 on = ST4 + ST3 ⋅ S1 ⋅ S2
ST4 off = ( ST4 ⋅ DELAY2 ( ST4, 4 ) )

Now, simplify these for implementation in ladder logic.

ST1on = ST1 + ST4 ⋅ TON 2 ( ST4, 4 ) ST1off = ( ST1 + S1 + S2 )

ST2 on = ST2 + ST1 ⋅ S1 ⋅ S2 ST2off = ( ST2 + TON 1 ( ST2, 4 ) )

ST3 on = ST3 + ST2 ⋅ TON 1 ( ST2, 4 ) ST3off = ( ST3 + S1 + S2 )

ST4 on = ST4 + ST3 ⋅ S1 ⋅ S2 ST4off = ( ST4 + TON 2 ( ST4, 4 ) )


page 353

ST4 timer on
T4:2
delay 4 sec

ST2 timer on
T4:1
delay 4 sec

TURN ON NEXT STATES FIRST

ST1
ST1

ST4 T4:2/DN

first scan

ST2 ST2

ST1 S1 S2

ST3
ST3

ST2 T4:1/DN

ST4 ST4

ST3 S1 S2
page 354

ST1 ST1 ST1

S1

S2

ST2 ST2 ST2

T4:1/DN

ST3
ST3 ST3

S1

S2

ST4 ST4 ST4

T4:2/DN
ST1 L1

ST2

ST4 L2

ST3 L3

ST3 L4

ST4

ST2 L5

ST1 L6
page 355

• Consider the state diagram below and implement it in ladder logic. You should anticipate what
will happen if both A and C are pushed at the same time.

STA STC
B D

FS
A C

STB

first scan

STA on = STA + STB ⋅ A + FS STA off = STA ⋅ B

STB on = STB + STA ⋅ B + STC ⋅ D STB off = STB ⋅ ( A + C )

STC on = STC + STB ⋅ C ⋅ A STC off = STC ⋅ D

NOTE: The equations are shown here for illustration purposes, but this technique is not
suitable because of the parallel branches in the equations.

23.3.1.4 - State Transition Equations

• This method deals updates the logic in a single scan, and only has a problem with competing
transitions.

• This implementation is based upon checking the state activation and deactivation separately.
page 356

First, define state variables and transitions,


ST1 = state 1 - grn NS T1 = transition from ST1 to ST2
ST2 = state 2 - yel NS T2 = transition from ST2 to ST3

ST3 = state 3 - grn EW T3 = transition from ST3 to ST4


ST4 = state 4 - yel EW T4 = transition from ST4 to ST1
T5 = transition to ST1 for first scan

Next, write the state entrance and exit condition equations,

T4 = ST4 ⋅ TON 2 ( ST4, 4 ) ST1 = ( ST1 + T4 + T5 ) ⋅ T1

T1 = ST1 ⋅ S1 ⋅ S2 ST2 = ( ST2 + T1 ) ⋅ T2

T2 = ST2 ⋅ TON 1 ( ST2, 4 ) ST3 = ( ST3 + T2 ) ⋅ T3

T3 = ST3 ⋅ S1 ⋅ S2 ST4 = ( ST4 + T3 ) ⋅ T4

T5 = FS
page 357

ST4 timer on
T4:2
delay 4 sec

ST2 timer on
T4:1
delay 4 sec
CALCULATE TRANSITIONS
ST4 T4:2/DN
T4

ST1 S1 S2 T1

ST2 T4:1/DN
T2

ST3 S1 S2 T3

FS T5
page 358

ST1 T1 ST1

T4

T5

ST2 T2 ST2

T1

ST3 T3 ST3

T2

ST4 T4 ST4

T3
page 359

ST1 L1

ST2

ST4 L2

ST3 L3

ST3 L4

ST4

ST2 L5

ST1 L6

• Consider the state diagram below and implement it in ladder logic. You should anticipate what
will happen if both A and C are pushed at the same time.
page 360

T5 T4
STA STC
B D
T1

FS
A C
T3
T2 STB

first scan
T1 = FS STA = ( STA + T2 + T1 ) ⋅ T5
T2 = STB ⋅ A STB = ( STB + T5 + T4 ) ⋅ T2 ⋅ T3
T3 = STB ⋅ C STC = ( STC + T3 ⋅ T2 ) ⋅ T4
T4 = STC ⋅ D
T5 = STA ⋅ B

• For practice,

implement the previous state diagram in ladder logic.

23.4 PARALLEL PROCESS FLOWCHARTS

• Parallel Processes can happen separately but must eventually work together. This happens when
PLC’s control multistage machines, etc.

• PLC’s are well suited to this problem.


page 361

• There is a method (based on Petri nets) that goes by a number of names,


- GRAFCET - developed in france
- IEC848 - the standard developed from GRAFCET
- SFC (Sequential Function Charts) - Allen Bradley version

• The basic elements are,


flowlines - connects steps and transitions (these basically indicate sequence)
transition - causes a shift between steps, acts as a point of coordination

Allows control to move to the next step when con-


ditions met (basically an if or wait instruction)

initial step - the first step

step - basically a state of operation. A state often has an associated action

step
action

macrostep - a collection of steps (basically a subroutine)


page 362

selection branch - an or - only one path is followed

simultaneous branch - an and - both (or more) paths are followed

• The example below shows a SFQ for a a controller that is watching two separate doors. One
door requires a two digit entry code, the second door requires a three digit entry code.
page 363

Start lock doors

1 1
1st digit 1st digit
1st digit wrong 1st digit wrong
OK OK

2 2

2st digit 2st digit


OK 2nd digit OK 2nd digit
wrong wrong
3
4 unlock#2
3rd digit
OK 3rd digit 5 sec.
wrong delay
4 unlock#1
5 relock#2
5 sec.
delay

5 relock#1

Parallel because things happen separately, but at same time (this can
also be done with state transition diagrams)

• SFC editors are available from many companies.

• SFCs can also be converted to ladder logic the same way state diagrams were.

• Consider the example below,


page 364

1
reset 7 6 part not
button detected
1
automatic
button
2 power on
light on

part detect 2

3 advance on
part hold on

bottom
4 stop 3 limit
button
4 advance off
5 light off retract on
advance off
power off
5 top
limit

6 retract off
part hold off
page 365

INITIALIZE STEPS AND TRANSITIONS


first scan
L step 1

U step 2

U step 3

U step 4

U step 5

U step 6

U transition 1

U transition 2

U transition 3

U transition 4

U transition 5

U transition 6

U transition 7
page 366

CHECK TRANSITIONS

transition 1 automatic on
step 2
L

transition 1
U
transition 7 reset button
transition 1
L

transition 7
U
transition 2 part detect
step 3
L

transition 2
U
transition 3 bottom limit
step 4
L

transition 3
U

transition 4
U
transition 4 stop button
step 5
L

transition 3
U

transition 4
U
page 367

transition 5 top limit


step 6
L

transition 5
U
transition 6 part detected
step 2
L

transition 6
PERFORM ACTIVITIES FOR STEPS U
step 2
power
L

light
L
step 3
advance
L

part hold
L

step 4
retract
L

advance
U
step 5
light
U

advance
U

power
U
page 368

step 6
retract
U

part hold
U
ENABLE TRANSITIONS
step 1
step 1
U

transition 1
L
step 2
step 2
U

transition 2
L
step 3
step 3
U

transition 3
L

transition 4
L
step 4
step 4
U

transition 5
L
step 5
step 5
U

transition 7
L
page 369

step 6
step 6
U

transition 6
L

23.4.1 Implementation with Microcontroller

• We could also write a program for the basic stamp 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

• For practice,
page 370

Develop an SFC for a vending machine and expand it into ladder logic.

23.5 SEQUENTIAL LOGIC CIRCUITS

23.5.1 Latches and Seal-in

• Latches are one function built into PLCs, but there are variations.

• Basically, latches allow one or more values to be frozen in time.


page 371

A A’

B B’

C C’

Latch (L)

A L A’

A’ L

B L B’

B’ L

C L C’

C’ L

• This circuit is a seal-in because the output locks the inputs on. After power is removed the logic
will default to off.

23.5.2 Shift Registers

• These allow values to be put into a ‘pipe-line’ where values are shifted through one at a time.
page 372

shift

23.6 PRACTICE PROBLEMS

6. Design ladder logic for the following process description.


a) A toggle start switch (TS1) and a limit switch on a safety gate (LS1) must both be on
before a solenoid (SOL1) can be energized to extend a stamping cylinder to the top
of a part. Should a part detect sensor (PS1) also be considered? Explain your
answer.
b) While the stamping solenoid is energized, it must remain energized until a limit switch
(LS2) is activated. This second limit switch indicates the end of a stroke. At this
point the solenoid should be de-energized, thus retracting the cylinder.
c) When the cylinder is fully retracted a limit switch (LS3) is activated. The cycle may not
begin again until this limit switch is active. This is one way to ensure that a new
part is present, is there another?
d) A cycle counter should also be included to allow counts of parts produced. When this
value exceeds some variable amount (from 1 to 5000) the machine should shut
down, and a job done light lit up.
e) A safety check should be included. If the cylinder solenoid has been on for more than 5
seconds, it suggests that the cylinder is jammed, or the machine has a fault. If this
is the case the machine should be shut down, and a maintenance light turned on.
f) Implement the ladder diagram on a PLC in the laboratory.
g) Fully document the ladder logic and prepare a short report - This should be of use to
another engineer that will be maintaining the system.

7. Write the ladder logic diagram that would be required to execute the following data manipula-
tion for a preventative maintenance program.

i) Keep track of the number of times a motor was started with toggle switch #1.
ii) After 2000 motor starts turn on an indicator light on the operator panel.
iii) Provide the capability to change the number of motor starts being tracked, prior to trig-
gering of the indicator light. HINT: This capability will only require the change of
a value in a compare statement rather than the addition of new lines of logic.
page 373

iv) Keep track of the number of minutes that the motor has run.
v) After 9000 minutes of operation turn the motor off automatically and also turn on an
indicator light on the operator panel.

11. 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 bot-
tom limit switch will stop the advance, and the cylinder must then be retracted until a top limit
switch is hit.

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

12. You have been asked to program a PLC-5 that is controlling a handicapped access door
opener. The client has provided the electrical wiring diagram below to show how the PLC
inputs and outputs have been wired. Button A is located inside and button B is located outside.
When either button is pushed the motor will be turned on to open the door. The motor is to be
kept on for a total of 15 seconds to allow the person to enter. After the motor is turned off the
door will fall closed. In the event that somebody gets caught in the door the thermal relay will
go off, and the motor should be turned off. After 20,000 cycles the door should stop working
and the light should go on to indicate that maintenance is required.
page 374

24 V DC 120 V AC
Output Card
Power
Supply
00
COM.
01 Relay
02

03

04 Motor

05
24 V lamp
06

07 +24 V DC
Power
COM Supply
GND
rack 00
slot 0
page 375

PLC Input Card


24V AC
00
24 V AC button A
01
Power button B
Supply 02
03
thermal relay
04
05
06
07

COM

rack 00
slot 1

a) Develop a state diagram for the control of the door.

button A + button B

motor on
door idle door opening

counter > 20,000


thermal relay + 15 sec delay

service mode
reset button - assumed

b) Convert the state diagram to ladder logic. (list the input and the output addresses first)
page 376

Legend
button A I:001/01
button B I:001/02
motor O:000/03
thermal relay I:001/03
reset button I:001/04 - assumed
state 1 B3:0/0
state 2 B3:0/1
state 3 B3:0/2
lamp O:000/07

first scan
MCR

state 1
L

state 2
U

state 3
U

MCR

state 2 motor

state 3 light
page 377

state 1
MCR

button A state 2
L

button B state 1
U

MCR
page 378

state 1
MCR

TON
T4:0
base 1
preset 15

T4:0/DN state 1
L

thermal relay state 2


U

CTU
C5:0
preset 20000

C5:0/DN state 3
L

state 2
U

state 1
U

MCR
page 379

state 3
MCR

reset button ?? state 1


L

state 3
U

RES counter

MCR

c) Convert the state diagram to Boolean equations.

S0 = ( S0 + S1 ( delay ( 15 ) + thermal ) )S0 ( buttonA + buttonB )

S1 = ( S1 + S0 ( buttonA + buttonB ) )S1 ( delay ( 15 ) + thermal )S3 ( counter )

S3 = ( S3 + S2 ( counter ) )S3 ( reset )

motor = S1

light = S3

13. Convert the following state diagram to equations.


page 380

Inputs Outputs A(C + D)


A P
B Q
C R
D S1
E
F F+E
S0
state P Q R BA
S0 0 1 1
E(C + D + F)
S1 1 0 1
S2 1 1 0

S2

14. Design a garage door controller using four techniques a) scripts, b) block logic, c) state equa-
tions, d) SFCs and e) flowcharts. 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.

ans.
a) scripting
The output [door opening] will stay on after input [button OR remote] and after state [door
closed]. It is stopped by input [button OR remote OR top limit] and is followed by state
[door opened].
The output [door closing] will stay on after input [button OR remote] and after state [door
opened]. It is stopped by input [button OR remote OR bottom limit] and is followed by
state [door closed]. It is stopped by input [not light beam] and followed by state [door
opening].
The output [garage light] will stay on after state [door opening OR door closing] and will
delay turning off for [300 seconds] after states [door opening OR door closing].
page 381

first scan
L door opened

U door opening

U door closed

U door closing

door opened remote


L door closing

button

door closing remote


L door closed

button
U door closing

bottom limit

door closing light beam


L door opening

U door closing
page 382

door closed remote


L door opening

button

door opening remote


L door opened

button
U door opening

top limit

door closing TOF


T4:0
preset 300s
door opening

T4:0/DN
garage light

ans.
b) block logic method door
closed remote OR button
(state 3)
remote OR button OR bottom limit

door light sensor door


closing opening
(state 2) (state 4)

remote OR button door remote OR button OR top limit


opened
(state 1)
page 383

first scan state 1


L

state 2
U

state 3
U

state 4
U

state 2 close door

state 4 open door

state 2 TOF
T4:0
preset 300s
state 4

T4:0/DN
garage light

state 1
MCR

remote state 1
U

button state 2
L

MCR
page 384

state 2
MCR

remote state 2
U

button state 3
L

bottom limit

light beam state 2


U

state 4
L

MCR

state 3
MCR

remote state 3
U

button state 4
L

MCR
page 385

state 4
MCR

remote state 2
U

button state 3
L

top limit

MCR

ans.
c) state equations door
closed remote OR button
(state 3)
remote OR button OR bottom limit

door light sensor door


closing opening
(state 2) (state 4)

remote OR button door remote OR button OR top limit


opened
(state 1)

using the previous state diagram.


ST1 = state 1 T1 = state 1 to state 2
ST2 = state 2 T2 = state 2 to state 3
ST3 = state 3 T3 = state 2 to state 4
ST4 = state 4 T4 = state 3 to state 4
FS = first scan T5 = state 4 to state 1

ST1 = ( ST1 + T5 ) ⋅ T1 T1 = ST1 ⋅ ( remote + button )


ST2 = ( ST2 + T1 ) ⋅ T2 ⋅ T3 T2 = ST2 ⋅ ( remote + button + bottomlimit )
T3 = ST2 ⋅ ( remote + button )
ST3 = ( ST3 + T2 ) ⋅ T4
T4 = ST3 ⋅ ( lighbeam )
ST4 = ( ST4 + T3 + T4 ) ⋅ T5 T5 = ST4 ⋅ ( remote + button + toplimit ) + FS
page 386

ST1 remote T1

button

ST2 remote T2

button

bottom limit

ST3 remote
T3

button

ST3 light beam T4

ST4 remote T5

button

top limit

first scan
page 387

T1 ST1 ST1

T5

T2 T3 ST2 ST2

T1

T4 ST3 ST3

T2

T5 ST4 ST4

T3

T4

ST2 close doo

ST4 open doo

ST2 TOF
T4:0
preset 300s
ST4

T4:0/DN
garage light
page 388

ans.
d) SFC 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
page 389

first scan
L step 1

step 2
U

step 3
U

step 4
U

step 5
U

T1
U

T2
U

T3
U

T4
U

T5
U
page 390

remote
T1
L step 3

button
U T1

remote
T2
L step 4

button
U T2

bottom limit
U T3

light beam
T3
L step 5

U T2

U T3

remote
T4
L step 5

button
U T4

remote
T5
L step 2

button
U T5

top limit
page 391

step 2
door open
U

door close
step 4
U

step 3
door close
L

step 5
door open
L

step 3 TOF
T4:0
preset 300s
step 5

T4:0/DN
garage light
page 392

step 1
step 1
U

step 2
L

step 2
step 2
U

T1
L

step 3
step 3
U

T2
L

T3
L

step 4
step 4
U

T4
L

step 5
step 5
U

T5
L
page 393

ans.
f) flowchart
start

is
ST1 remote or no
button pushed?

yes

ST2 turn on door close

is ST4
ST3 remote or no is
button or bottom light beam yes
limit pushed? on?

yes no
ST5
turn off door close

ST6 is
remote or
button pushed?

yes
ST7
turn on door open

is
ST8 remote or no
button or top
limit pushed?

ST9 yes

turn off door open


page 394

first scan
L ST1

U ST2

U ST3

U ST4

U ST5

U ST6

U ST7

U ST8

U ST9

U door open

U door close

ST2 TOF
T4:0
preset 300s
ST7

T4:0/DN
garage light
page 395

ST1
MCR

button
U ST1

remote ST2
L

MCR

ST2
MCR

U ST2

ST3
L

door close
L

MCR
page 396

ST3
MCR

button
U ST3

remote ST5
L

bottom limit

ST3
U ST3

ST4
L

MCR

ST4
MCR

light beam
U ST4

ST7
L

light beam
U ST4

ST3
L

MCR
page 397

ST5
MCR

U ST5

ST6
L

door close
U

MCR

ST6
MCR

button
U ST6

remote ST7
L

MCR

ST7
MCR

U ST7

ST8
L

door open
L

MCR
page 398

ST8
MCR

button
U ST8

remote ST9
L

top limit

MCR

ST9
MCR

U ST9

ST1
L

door open
U

MCR

15. This morning you received a call from Mr. Ian M. Daasprate at the Old Fashioned Widget
Company. In the past when they built a new machine they would used punched paper cards for
control, but their supplier of punched paper readers went out of business in 1972 and they have
decided to try using PLCs this time. He explains that the machine will dip wooden parts in var-
nish for 2 seconds, and then apply heat for 5 minutes to dry the coat, after this they are manu-
ally removed from the machine, and a new part is put in. They are also considering a premium
line of parts that would call for a dip time of 30 seconds, and a drying time of 10 minutes. He
then refers you to the project manager, Ann Nooyed.
You call Ann and she explains how the machine should operate. There should be start and stop
buttons. The start button will be pressed when the new part has been loaded, and is ready to be
coated. A light should be mounted to indicate when the machine is in operation. The part is
page 399

mounted on a wheel that is rotated by a motor. To dip the part, the motor is turned on until a
switch is closed. To remove the part from the dipping bath the motor is turned on until a second
switch is closed. If the motor to rotate the wheel is on for more that 10 seconds before hitting a
switch, the machine should be turned off, and a fault light turned on. The fault condition will
be cleared by manually setting the machine back to its initial state, and hitting the start button
twice. If the part has been dipped and dried properly, then a done light should be lit. To select a
premium product you will use an input switch that needs to be pushed before the start button is
pushed. She closes by saying she will be going on vacation and you need to have it done before
she returns.
You hang up the phone and, after a bit of thought, decide to use a SLC-150 with the following out-
puts and inputs,

INPUTS OUTPUTS
001 - start push button 011 - start button
002 - stop button 012 - in operation
003 - premium part push button 013 - fault light
004 - switch - part is in bath on wheel 014 - part done light
005 - switch - part is out of bath on wheel 015 - motor on
111 - heater power supply

a) Draw a state diagram for the process.


b) List the relays needed to indicate when each state is on, and list any timers and counters
used.
c) Write a Boolean expression for each transition in the state diagram.
d) Do a simple wiring diagram for the SLC-150.
e) Write the ladder logic for the state that involves moving the part into the dipping bath.

16. Given the following state diagram, use equations to implement ladder logic.

state 1 A state 3
C*B

B
state 2 C+B
page 400

FS = first scan
ans.
T1 = ST2 ⋅ A
A
ST1 C*B ST3 T2 = ST1 ⋅ B
T1 T3 = ST3 ⋅ ( C ⋅ B )
T3
T4 = ST2 ⋅ ( C + B )
T4
B T2 ST1 = ( ST1 + T1 ) ⋅ T2 + FS
ST2 = ( ST2 + T2 + T4 ) ⋅ T1 ⋅ T4
ST2 C+B ST3 = ( ST3 + T4 ⋅ T1 ) ⋅ T4

ST2 A
T1

ST1 B T2

ST3 C B
T3

ST2
C T4

B
T2
ST1 ST1

T1
first scan

T1 T4
ST2 ST2

T2

T4
T4
ST3 ST3

T4 T1
page 401

17. Convert the following flow chart to ladder logic.

start

A on

yes
is B on?
no

A off

no
is C on?
yes
page 402

ans. first scan


start
L F1

U F2 F1
A on
U F3

U F4 F2 yes
F1 is B on?
MCR
no
L A
F3
A off
U F1

L F2 F4
no
is C on?
MCR
F2 yes
MCR
B
U F2

L F3
F4
MCR MCR
F3 C
MCR U F4

U A L F1
C
U F4
U F3

L F4 L F2
MCR
MCR

18. Convert the following state diagram to logic using equations.


page 403

A
state 1 state 2
B

C
E
D
F

state 3
page 404

ans. TA = ST2 ⋅ A ST1 = ( ST1 + TA + TC ) ⋅ TB ⋅ TD


TB = ST1 ⋅ B ST2 = ( ST2 + TB + TF ) ⋅ TA ⋅ TE
TC = ST3 ⋅ C ST3 = ( ST3 + TD + TE ) ⋅ TC ⋅ TF
TD = ST1 ⋅ D ⋅ B
TE = ST2 ⋅ E ⋅ A
TF = ST3 ⋅ F ⋅ C
ST2 A
TA
ST1 B
TB
ST3 C
TC
ST1 D B
TD
ST2 E A
TE
ST3 F C
TF
ST1 TB TD
ST1
TA

TC

ST2 TA TE
ST2
TB

TF

ST3 TC TF
ST3
TD

TE

19. A welding station is controlled by a PLC. On the outside is a safety cage that must be closed
while the cell is active. A belt moves the parts into the welding station and back out. An inductive
proximity sensor detects when a part is in place for welding, and the belt is stopped. To weld, an
actuator is turned on for 3 seconds. As normal the cell has start and stop push buttons.
a) Draw a flow chart
b) Implement the chart in ladder logic
page 405

Inputs Outputs

DOOR OPEN (NC) CONVEYOR ON


START (NO) WELD
STOP (NC)
PART PRESENT

20. In dangerous processes it is common to use two palm buttons that require a operator to use
both hands to start a process (this keeps hands out of presses, etc.). To develop this there are two
inputs (P1 and P2) that must both be turned on within 0.25s of each other before a machine cycle
may begin.

Develop ladder logic to control a process that has a start (START) and stop (STOP) button for the
power. After the power is on the palm buttons (P1 and P2) may be used as described above to start
a cycle. The cycle will consist of turning on an output (MOVE) for 2 seconds. After the press has
been cycled 1000 times the press power should turn off and an output (LIGHT) should go on.

21. Convert the following state diagram to ladder logic using equations. Give the stop button
higher priority.

A ST1: 1 on
ST0: idle
STOP B

STOP
D + STOP
ST2: 2 on
C
ST3: 3 on
page 406

24. ADVANCED LADDER LOGIC FUNCTIONS

• Advanced PLC functions go beyond basic ladder logic, and allow capabilities like full program-
ming languages.

• Note: When executing most ladder logic the inputs are read at the beginning of the scan, and the
output are set at the end. When using functions the values are changed imediately.

24.1 ADDRESSING

• To use advanced data functions in a PLC, we must first understand the structure of the data in the
PLC memory.

• There are two types of memory used in a PLC-5.


Program Files - these are a collection of 1000 slots to store up to 1000 programs. The main
program will be stored in program file 2. SFC programs must be in file 1, and file
0 is used for program and password information. All other program files from 3 to
999 can be used for ‘subroutines’.
Data Files - This is where the variable data is stored that the PLC programs operate on.
This is quite complicated, so a detailed explanation follows.

24.1.1 Data Files

• In brief PLC memory works like the memories in a pocket calculator. The values below are for a
PLC-5, although most Allen-Bradley PLCs have a similar structure.
page 407

For Allen-Bradley PLC-5

Rack
I/O slot number in rack

Interface to O:000 outputs


outside world I: inputs
S2: processor status
B3: bits in words
T4: timers
Fixed types of counters
C5:
Data files control words
R6:
N7: integer numbers
F8: floating point numbers

Other files 9-999 can be created and and used.


The user defined data files can have different
data types.

• These memory locations are typically word oriented (16 bits, or 2 bytes). This includes the bit
memory. But the T4, C5, R6 data files are all three words long.

• All values are stored and used as integers (except when specified, eg. floating point). When inte-
gers are stored in binary format 2’s complements are used to allow negative numbers. BCD
values are also used.

• There are a number of ways the PLC memory can be addressed,


bit - individual bits in memory can be accessed - this is like addressing a single output as a
data bit

I:000/02 - the third input bit from input card I:000


B3:3 - a bit in memory
word/integer - 16 bits can be manipulated as a group

N7:8 - an integer from memory


I:000 - an integer with all input values from an input card
data value - an actual data value can be provided

8 - an integer
8.5 - a floating point number
page 408

file level - an array of data values can be manipulated and operated on as a group

#F8:5 - indicates a group of values starting at F8:5


#N7:0 - indicates a group of values starting at I7:0
indirect - another memory location can be used in the description of a location.

I:000/[N7:2] -If the integer memory N7:2 location contains 5 this will become I:000/
I:[N7:1]/03 -If the integer memory location contains 2 this will become I:002/03
#I:[N7:1] -If the integer memory location contains 2 the file will start at I:002

expression - a text string that describes a complex operation

“sin(F8:3) + 1.3” - a simple calculation

• For the user assigned data files from 9 to 999 different data types can be assigned. These can be
one of the data types already discussed, or another data type.
A - ASCII
B - bit
BT - block transfer
C - counter
D - BCD
F - floating point
MG - message
N - integer (signed, unsigned, 2s compliment, BCD)
PD - PID controller
R - control
SC - SFC status
ST - ASCII string
T - timer

24.1.1.1 - Inputs and Outputs

• Recall that the inputs and outputs use octal for specific bits. This means that the sequence of out-
put bits is 00, 01, 02, 03, 04, 05, 06, 07, 10, 11, 12, 13, 14, 15, 16, 17

24.1.1.2 - User Bit Memory

• Bit data file B3 is well suited to use of single bits. the data is stored as words and this allows two
different ways to access the same bit.
B3:0/0 = B3/0
B3:0/10 = B3/10
B3:1/0 = B3/16
page 409

B3:1/5 = B3/21
B3:2/0 = B3/32
etc...

• The integer file N7 stores words in 2’s complement form. This allows values from -32768 to
32767. These values can be addressed as whole words, and individual bits can also be changed.

• The floating point file F8 will store floating point numbers that can only be used by floating
point functions. The structure of these numbers does not allow bit access.

24.1.1.3 - Timer Counter Memory

• Timer T4 values are addressed using the number of the timers, and an associated data type. For
example the accumulator value of timer 3 is T4:3.ACC or T4:3/ACC.
EN - timer enabled bit (bit 15)
TT - timer timing bit (bit 14)
DN - timer done bit (bit 13)
PRE - preset word
ACC - accumulated time word

• Counter C5 values are addressed using the number of the counters, and an associated data type.
For example the accumulator value of counter 3 is C5:3.ACC or C5:3/ACC.
CU - count up bit (bit 15)
CD - count down bit (bit 14)
DN - counter done bit (bit 13)
OV - overflow bit (bit 12)
UN - underflow bit (bit 11)
PRE - preset word
ACC - accumulated count word

• The values for the timers and counters can be accesses directly.
page 410

Words
T4:0.PRE - the preset value for timer T4:0
T4:0.ACC - the accumulated value for timer T4:0
C5:0.PRE - the preset value for counter C5:0
C5:0.ACC - the accumulated value for counter C5:0
Bits
T4:0/EN - indicates when the input to timer T4:0 is true
T4:0/TT - indicates when the timer T4:0 is counting
T4:0/DN - indicates when timer T4:0 has reached the maximum
C5:0/CU - indicates when the count up instruction is true for C5:0
C5:0/CD - indicates when the count down instruction is true for C5:0
C5:0/DN - indicates when the counter C5:0 has reached the preset
C5:0/OV - indicates when the counter C5:0 has reached the maximum value (32767)
C5:0/UN - indicates when the counte C5:0 has reached the mimimum value (-32768)

• Consider the example below,

Design some simple ladder logic to turn on a light for the first 10 sec-
onds after a door is opened.

24.1.1.4 - PLC Status Bits (for PLC-5s and Micrologix)

• Some of the more commonly useful status bits in data file S2 are given below. Full listings are
given in the manuals.
S2:0/0 carry in math operation
S2:0/1 overflow in math operation
S2:0/2 zero in math operation
page 411

S2:0/3 sign in math operation


S2:1/15 first scan of program file
S2:8 the scan time (ms)
S2:18 year
S2:19 month
S2:20 day
S2:21 hour
S2:22 minute
S2:23 second
S2:28 watchdog setpoint
S2:29 fault routine file umber
S2:30 STI (selectable timed interrupt) setpoint
S2:31 STI file number
S2:46-S2:54,S2:55-S2:56 PII (Programmable Input Interrupt) settings
S2:55 STI last scan time (ms)
S2:77 communication scan time (ms)

24.1.1.5 - User Function Control Memory

• Control file R6 is used by various functions to track progress. Values that are available are,
listed below. The use of these bits is specific to the function using the control location.
EN - enable bit (bit 15)
EU - enable unload (bit 14)
DN - done bit (bit 13)
EM - empty bit (bit 12)
ER - error bit (bit 11)
UL - unload bit (bit 10)
IN - inhibit bit (bit 9)
FD - found bit (bit 8)
LEN - length word
POS - position word

• Different bits will use these memory locations differently. It will be rare for any instruction to
use all of these memory bits and words.

24.1.1.6 - Integer Memory

• This memory can hold values from -32768 to +32767 - These values cannot be exceeded.

• Decimal fractions are not allowed.

• The values are stored as 2’s compliment.

• These values are normally stored in N7:xx by default, but new blocks of integer memory are
page 412

often created in other locations.

24.1.1.7 - Floating Point Memory

• This can hold real values with fraction in the range of +/-1.1754944e-38 to +/-3.4028237e38.

• These values are always limited to 7 digits of accuracy.

• Floating point memoy is stored in F8:xx by default.

24.2 INSTRUCTION TYPES

• There are basic categories of instructions,


Basic (discussed before)
- relay instructions
- timer instructions
- counter instructions
Program Control
- branching/looping
- immediate inputs/outputs
- fault/interrupt detection
Basic Data Handling
- moves
- computation instructions
- boolean instructions
- conversion
Logical
- comparisons
Advanced Data Handling
- file instructions
- shift registers/stacks
Complex
- PID
- communications
- high speed counters
- ASCII string functions

• The reader should be aware that some functions are positive edge triggered (i.e. they only work
the scan is active). while most are active any time the input is active. Some examples of edge
triggered and non-edge triggered functions are listed below,
Edge Triggered
CTU, CTD
page 413

Non-edge triggered
TON, TRO, TOF, ADD, MUL, etc.

24.2.1 Basic Data Handling

• Some handy functions found in PLC-5’s (similar functions are available in other PLC’s)

24.2.1.1 - Move Functions

• There are two types of move functions,


MOV(value,destination) - moves a value to a memory location
MVM(value,mask,destination) - moves a value to a memory location, but with a mask to
select specific bits.

• The following function moves data values between memory locations. The following example
moves a floating point number from floating point memory 7 to 23

MOV

Source F8:07
Destination F8:23

• The following example moves a floating point number from floating point memory F8:7 to inte-
ger memory N7:23

MOV

Source F8:07
Destination N7:23

• The following example puts an integer value 123 in integer memory N7:23
page 414

MOV

Source 123
Destination N7:23

• A more complex example of the move functions follows,

MOV
source 130
dest N7:0

MOV
source N7:1
dest N7:2

MVM
source N7:3
mask N7:4
dest N7:5

before (binary) after (binary)

N7:0 0000000000000000 N7:0 0000000010000010


N7:1 1101101101010111 N7:1 1101101101010111
N7:2 0000000000000000 N7:2 1101101101010111
N7:3 1101100010111011 N7:3 1101100010111011
N7:4 1010101010101010 N7:4 1010101010101010
N7:5 0000000000000000 N7:5 1000100010101010

24.2.1.2 - Mathematical Functions

• These functions use values in memory, and store the results back in memory (Note: these func-
tions do not use variables like normal programming languages.)

• Math functions are quite similar. The following example adds the integer and floating point
number and puts the results in ‘F8:36’.
page 415

ADD

source A N7:04
source B F8:35
destination F8:36

• Basic PLC-5 math functions include,


ADD(value,value,destination) - add two values
SUB(value,value,destination) - subtract
MUL(value,value,destination) - multiply
DIV(value,value,destination) - divide
NEG(value,destination) - reverse sign from positive/negative
CLR(value) - clear the memory location

• Consider the example below,


page 416

ADD
source A N7:0
source B N7:1
dest. N7:2
ADD addr. before after
source A 1
source B N7:3 N7:0 10 10
dest. N7:3 N7:1 25 25
N7:2 0 35
SUB N7:3 0 1
source A N7:1 N7:4 0 -10
source B N7:2 N7:5 0 250
dest. N7:4 N7:6 0 2
MULT N7:7 0 10
source A N7:0 N7:8 100 0
source B N7:1
dest. N7:5 F8:0 10.0 10.0
F8:1 25.0 25.0
DIV F8:2 0 2.5
source A N7:1 F8:3 0 2.0
source B N7:0
dest. N7:6
NEG
source A N7:4 Note: integer values are
dest. N7:7 limited to ranges
between -32768 and
CLR 32767, and there are no
dest. N7:8 fractions.
DIV
source A F8:1
source B F8:0
dest. F8:2
DIV
source A N7:1
source B N7:0
dest. F8:3

• As an exercise, try the calculation below with ladder logic,


page 417

N7:2 = -(5 - N7:0 / N7:1)

• Some intermediate math functions include,


CPT(destination,expression) - does a calculation
ACS(value,destination) - inverse cosine
COS(value,destination) - cosine
ASN(value,destination) - inverse sine
SIN(value,destination) - sine
ATN(value,destination) - inverse tangent
TAN(value,destination) - tangent
XPY(value,value,destination) - X to the power of Y
LN(value,destination) - natural log
LOG(value,destination) - base 10 log
SQR(value,destination) - square root

• Examples of some of these functions are given below.


page 418

given
C
A = ln B + e acos ( D )
assign
A = F8:0
B = F8:1
C = F8:2
D = F8:3

LN
SourceA F8:1
Dest. F8:4

XPY
SourceA 2.718
SourceB F8:2
Dest F8:5

ACS
SourceA F8:3
Dest. F8:6

MUL
SourceA F8:5
SourceB F8:6
Dest F8:7

ADD
SourceA F8:4
SourceB F8:7
Dest F8:7

SQR
SourceA F8:7
Dest. F8:0

It can also be done with a compute expression

CPT
Dest. F8:0
Expression
SQR(LN(F8:1)+XPY(2.718,F8:2)*ACS(F8:3))
page 419

• For practice implement the following function,

y + log ( y )
x = atan  y  ------------------------ 
y+1

• Some functions are well suited to statistics.


AVE(start value,destination,control,length) - average of values
STD(start value,destination,control,length) - standard deviation of values
SRT(start value,control,length) - sort a list of values

• Examples of these functions are given below.


page 420

AVE
File #F8:0
Dest F8:4
Control R6:1
length 4
position 0

STD
File #F8:0
Dest F8:5
Control R6:2
length 4
position 0

SRT
File #F8:0
Control R6:3
Addr. before after length 4
position 0
F8:0 3 1
F8:1 1 2
F8:2 2 3
F8:3 4 4
F8:4 0 2.5
F8:5 0 1.29

• There are also functions for basic data conversion.


TOD(value,destination) - convert from BCD to binary
FRD(value,destination) - convert from binary to BCD
DEG(value,destination) - convert from radians to degrees
RAD(value,destination) - convert from degrees to radians

• Examples of these functions are given below.


page 421

FRD
Source A D9:0
Dest. N7:0

TOD
Source A N7:1
Dest. D9:1

DEG
Source A F8:0
Dest. F8:2

RAD
Source A F8:1
Dest. F8:3

Addr. before after

N7:0 0000000000000000 0000011100000001


N7:1 0000001000100100 0000001000100100
F8:0 3.141 3.141
F8:1 45 45
F8:2 0 180
F8:3 0 0.785
D9:0 0000 0000 0000 0000 0000 0101 0100 1000
D9:1 0001 0111 1001 0011 0001 0111 1001 0011

24.2.2 Logical Functions

24.2.2.1 - Comparison of Values

• These functions act like input contacts. The equivalent to these functions are if-then statements
in traditional programming languages.

• Basic comparison functions in a PLC-5 include,


CMP(expression) - compares two values for equality
EQU(value,value) - equal
page 422

NEQ(value,value) - not equal


LES(value,value) - less than
LEQ(value,value) - less than or equal
GRT(value,value) - greater than
GEQ(value,value) - greater than or equal

• The comparison function below compares values at locations A and B. If they are not equal, the
output is true. The use of the other comparison functions is identical.

O:012
NEQ
A N7:03
B N7:02 04

O:012
CMP
OR expression
N7:03 <> N7:02 04

• More advanced comparison functions in a PLC-5 include,


MEQ(value,mask,threshold) - compare for equality using a mask
LIM(low limit,value,high limit) - check for a value between limits

• Examples of these functions are shown below.


page 423

LIM
low limit N7:0 N7:4/0
test value N7:1
high limit N7:2

LIM
low limit N7:2 N7:4/1
test value N7:1
high limit N7:0

LIM
low limit N7:2 N7:4/2
test value N7:3
high limit N7:0

MEQ
source N7:0 N7:4/3
mask N7:1
compare N7:2

Addr. after (decimal) after (binary)

N7:0 1 0000000000000001
N7:1 5 0000000000000101
N7:2 11 0000000000001011
N7:3 15 0000000000001111
N7:4 0000000000001101

24.2.2.2 - Binary Functions

• These functions allow Boolean operations on numbers and values in the PLC memory.

• Binary functions are also available for,


AND(value,value,destination) - Binary and function
OR(value,value,destination) - Binary or function
NOT(value,value,destination) - Binary not function
XOR(value,value,destination) - Binary exclusive or function
page 424

• Examples of the functions are,

AND
source A N7:0
source B N7:1
dest. N7:2
OR
source A N7:0
source B N7:1
dest. N7:3
XOR
source A N7:0
source B N7:1
dest. N7:4
NOT
source A N7:0
dest. N7:5

addr. data (binary)


N7:0 0011010111011011
N7:1 1010010011101010
after N7:2 1010010011001010
N7:3 1011010111111011
N7:4 1001000100110001
N7:5 1100101000100100

24.2.3 Boolean Operations

• In most discrete systems the inputs and outputs (I/O) are either on or off. This is a binary state
that will be represented with,

1 = on
0 = off

• Because there are many inputs and outputs, these can be grouped (for convenience) into binary
numbers.

• Consider an application of binary numbers. There are three motors M1, M2 and M3
100 = Motor 1 is the only one on
111 = All three motors are on
page 425

in total there are 2n or 23 possible combinations of motors on.

• The most common Binary operations are,

Name Example Result

AND 0010 * 1010 0010


OR 0010 + 1010 1010
NOT 0010 1101
EOR 0010 eor 1010 1000
NAND 0010 * 1010 1101
shift left 111000 110001 (other results are possible)
shift right 111000 011100 (other results are possible)
etc.
*There are many other operations in addition to this list.
** These operations and the others can be useful for some complicated operations

24.2.4 Binary Mathematics

• These include standard logic forms such as,


- and/or/add, etc.
- compliments

• Negative numbers are a particular problem with binary numbers. As a result there are two com-
mon numbering systems use,
- signed binary - the most significant bit (MSB) of the binary number is used to indicate
positive/negative
- 2s compliment - negative numbers are represented by complimenting the binary number
and then adding 1.

• Signed binary numbers are easy to understand, but much harder to work with when doing calcu-
lations.

• An example of 2s compliments are given below,


page 426

decimal binary byte METHOD FOR MAKING A NEGATIVE NUMBER

2 00000010 1. write the binary number for the positive


1 00000001
for -30 we write 30 = 00011110
0 00000000
-1 11111111 2. Invert (compliment) the number
-2 11111110
00011110 becomes 11100001

3. Add 1
11100001 + 00000001 = 11100010

• When adding 2s compliment numbers, additional operations are not needed to deal with nega-
tive numbers. Consider the examples below,

00000001 = 1 00000001 = 1 00000010 = 2


+ 11111111 = -1 + 11111110 = -2 + 11111111 = -1
C+00000000 = 0 11111111 = -1 C+00000001 = -1

ignore the carry bits Note: Normally the carry bit is ignored during the oper-
ation, but some additional logic is required to make
sure that the number has not ‘overflowed’ and moved
outside of the range of the numbers. Here the 2s com-
pliment byte can have values from -128 to 127.

24.2.5 BCD (Binary Coded Decimal)

• Each digit is encoded in 4 bits

1263 BCD
Note: this example shows four digits
in two bytes. The hex values
would also be 1263.
0001 0010 0110 0011 decimal

• This numbering system makes poor use of the digits, but is easier to convert to/from base 10
page 427

numbers. For the two bytes above the maximum numbers possible are from 0-9999 in BCD,
but 0-64285 in binary.

• Convert the BCD number below to a decimal number,

0110 0010 0111 1001

• Convert the following binary number to a BCD number,

0100 1011

24.2.6 Advanced Data Handling

24.2.6.1 - Multiple Data Value Functions

• We can also deal with large ‘chunks’ of memory at once. These will not be covered, but are
available in texts. Some functions include,
- move/copy memory blocks
- add/subtract/multiply/divide/and/or/eor/not/etc blocks of memory

• These functions are similar to single value functions, but they also include some matrix opera-
tions. For a PLC-5 a matrix, or block of memory is also known as an array.
page 428

• The basic functions are,


FAL(control,length,mode,destination,expression) - will perform basic math operations to
multiple values.
FSC(control,length,mode,expression) - will do a comparison to multiple values
COP(start value,destination,length) - copies a block of values
FLL(value,destination,length) - copies a single value to a block of memory

• These functions are done on a PLC-5 using file commands. Typical operations include
file to file - copy an array of memory from one location to another.
element to file - one value is copied to a block of memory
file to element - can convert between data types
file add - add arrays
file subtract - subtract arrays
file multiply - multiply arrays
file divide - divide an array by a value
convert to/from BCD
AND/OR/XOR/NOT - perform binary functions.

• Examples of these functions are shown below.


page 429

FAL
Control R6:0
length 5 file to file
position 0
Mode all
Destination #N7:5
Expression #N7:0 + 5

FAL
Control R6:0
length 5 element to file
position 0 file to element
Mode incremental
Destination #N7:5
Expression N7:0 + 5

FAL
Control R6:0
length 5
position 0 file to element
Mode incremental
Destination N7:5
Expression #N7:0 + 5

• a useful function not implemented on PLC-5 processors is a memory exchange.

24.2.7 Complex Functions

24.2.7.1 - Shift Registers

• The values can be shifted left or right with the following functions.
BSL - shifts left from the LSB to the MSB. The LSB must be supplied
BSR - similar to the BSL, except the bit is input to the MSB and shifted to the LSB

• These use bit memory blocks of variable length.

• An example of a shift register is given below. In this case it is taking the value of bit B3:1/0 and
page 430

putting it in the control word bit R6:2/UL. It then shifts the bits once to the right, B3:1/0 =
B3:1/1 then B3:1/1 = B3:1/2 then B3:1/2 = B3:1/3 then B3:1/3 = B3:1/4. Then the input bit is
put into the most significant bit B3:1/4 = I:000/00.

bits shift right

B3:1 MSB 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 LSB


15 00

I:000/00 5 R6:2/UL

BSR
File B3:1
Control R6:2
Bit address I:000/00
Length 5

• There are other types of shift registers not implemented in PLC-5s.

Arithmetic Shift Left (ASL)


carry msb lsb
0 0 0 0 0 0 0 0 0 0

Arithmetic Shift Right (ASR)


carry
0 0 0 0 0 0 0 0 0 0

Rotate Left (ROL)


0 0 0 0 0 0 0 0
carry
0

Rotate Right (ROR)


0 0 0 0 0 0 0 0
carry
0
page 431

24.2.7.2 - Stacks

• We can also use stack type commands. These allow values to be stored in a ‘pile’. This allows us
to write programs that will accumulate values that can be used later, or in sequence.

• The basic concept of a FIFO stack is that the first element in is the first element out.

• The PLC-5 commands are FFL to load the stack, and FFU to unload it.

• The example below shows two instructions to load and unload the stack. The first time FFL is
activated it will grab all of the bits from the input card I:001 and store them on the stack, at
N7:0. The next value would be at N7:1, and so on until the stack length is met. When FFU is
used the value at N7:0 will be moved to set all of the bits on the output card O:003 and the val-
ues on the stack will be shifted up so that the value previously in N7:1 is now in N7:0, etc.
(note: the source and destination do not need to be inputs and outputs)

A
FFL
source I:001
FIFO N7:0
Control R6:0
length 5
position 0

B
FFU
FIFO N7:0
destination O:003
Control R6:0
length 5
position 0

• A Last-In-First-Out stack can also be used with the LFL/LFU functions.

24.2.7.3 - Sequencers

• Basically, sequencers are a method for using predetermined patterns to drive a process

• These were originally based on motor driven rotating cams that made and broke switches. When
a number of these cams were put together, they would be equivalent to a binary number, and
could control multiple system variables.
page 432

As it rotates it makes contact with


none, one, or two terminals, as
determined by the depressions and
rises in the rotating cam.

• A sequencer can keep a set of values in memory and move these to memory locations (such as
an output card) when directed.

• These are well suited to state diagrams/processes with a single flow of execution (like traffic
lights)

• The commands are,


SQO(start,mask,source,destination,control,length) - sequencer output from table to mem-
ory address
SQI(start,mask,source,control,length) - sequencer input from memory address to table
SQL(start,source,control,length) - sequencer load to set up the sequencer parameters

• An example of a sequencer is given below for traffic light control. The light patterns are stored
in memory (entered manually by the programmer). These are then moved out to the output
card as the function is activated. The mask (003F = 0000000000111111) is used so that only
the 6 LSB are changed.
page 433

SQO
File B3:0
Mask 003F
Destination O:000
Control R6:0
Length 4
Position 0

B3:0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
B3:4 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 EW - green
EW - yellow
EW - red
NS - green
NS - yellow
NS - red

24.2.8 Program Control Structures

• These change the flow of execution of the ladder logic.

24.2.8.1 - Branching and Looping

• These functions allow control found in languages like Fortran


IF-THEN is like MCR (Master Control Reset)
GOTO is like JMP (Jump)
SUBROUTINES is like Program Files

• MCR blocks have been used earlier, but they are worth mentioning again.
page 434

MCR

A
MCR

If A is true then the MCR will cause the ladder in between


to be executed. If A is false it is skipped.

MCR

• Block of ladder logic can be bypassed using a jump statment.

JMP

A B
JMP 01

If A and B are true, the program will jump to LBL:01


to be executed. If A or B is false it is skipped.

LBL 01

• Subroutines allow reusable programs to be written and called as needed. They are different from
jump statements because they are not part of the main program (they are other program files),
and arguments can be passed and returned.
page 435

SUBROUTINES/PROGRAM FILES
A JSR (Jump subroutine)
program file 2 Program File 3
Input par N7:0
Input par 123
Return par N7:1

A separate ladder logic program is stored in program file 3. This fea-


ture allows the user to create their own ‘functions’. In this case if
A is true, then the program below will be executed and then when
done the ladder scan will continue after the subroutine instruction.
The number of data values passed and returned is variable.

SBR (subroutine arguments)


Input par N10:0

If B is true the subroutine will return and the values listed will be
returned to the return par. For this example the value that is in
N10:1 will eventually end up in N7:1
program file 3

B RET
Return par N10:1

• For next loops can also be done to repeat blocks of ladder logic inside a single scan. Care must
be used for this instruction so that the ladder logic does not get caught in an infinite, or long
loop - if this happens the PLC will experience a fault and halt.
page 436

A
FOR
label number 0
index N7:0
initial value 0
terminal value 9
step size 1

ADD
Source A 1
Source B N7:1
Dest N7:1

NXT
label number 0

Note: if A is true then the loop will repeat 10 times, and the value of N7:1 will be
incresed by 10. If A is not true, then the ADD function will only be executed once
and N7:1 will increase in value by 1.

• Ladder logic programs always have an end statement, but it is often taken for granted and
ignored. Most modern software automatically inserts this. Some PLCs will experience faults if
this is not present.

A B C

END

When the end (or End Of File) is encountered the PLC will stop scanning the
ladder, and start updating the outputs. This will not be true if it is a subroutine
or a step in an SFC.

• There is also a temporary end (TND) that for a single ladder scan will skip the remaining portion
of a program.

• A one shot contact can be used to turn on a ladder run for a single scan. When the run has a pos-
page 437

itive rising edge the oneshot will turn on the run for a single scan. Bit ‘B3:0’ is used here to
track to rung status.

A B3:0
ONS B

24.2.8.2 - Immediate I/O Instructions

• The normal operation of the PLC is

fast [input scan]


Input values read

outputs are updated in


slow [ladder logic is checked]
memory only as ladder
logic scanned

Output values are


fast [outputs updated]
changed to match
values in memory

• This approach avoids problems caused by logic setting and resetting outputs before done.

• If we have a problem we may want to update an output immediately, and not wait for the PLC to
complete its scan of the ladder logic. To do this we use immediate inputs and outputs.
page 438

e.g. Check for nuclear reactor overheat

I:001/03 overheat sensor


O:010/01 reactor shutdown

I:001
IIN
I:001/03
O:010/01

O:010
IOT

These added statements can allow the ladder logic to examine a critical
input, and adjust a critical output many times during the execution of
ladder logic that might take too long for safety.

24.2.8.3 - Fault Detection and Interrupts

• The PLC can be set up to run programs automatically. This is normally done for a few reasons,
- to deal with errors that occur (eg. divide by zero)
- to run a program at a regular timed interval (eg. SPC calculations)
- to respond when a long instruction is complete (eg. analog input)
- when a certain input changed (eg. panic button)

• Two types of errors will occur - terminal (critical) and warnings (non-critical). A critical failure
will normally stop the PLC.

• In some applications faults and failures must be dealt with in logic if possible, if not the system
must be shut down.

• There are some memory locations that store indications of warning and fatal errors that have
occurred. The routine in program file [S:29] needs to be able to detect and clear the fault.
S:29 - program file number to run when a fault occurs

• To set a timed interrupt we will set values in the status memory as indicated below. The program
in file [S:31] will be run every [S:30]ms.
S:30 - timed delay between program execution - an integer number of ms
S:31 - the program number to be run
page 439

• To cause an interrupt when a bit changes the following bits can be set.
S:46 - the program file to run when the input bit changes
S:47 - the rack and group number (eg. if in the main rack it is 000)
S:48 - mask for the input address (eg. 0000000000000100 watches 02)
S:49 - for positive edge triggered =1 for negative edge triggered = 0
S:50 - the number of counts before the interrupt occurs 1 = always up to 32767

24.2.9 Block Transfer Functions

• Certain PLC cards only have a single address (eg. O:001 or I:001) but multiple data values need
to be read or written to it. To do this the block transfer functions are used.

• These will be used in the labs for analog input/output cards.

• These functions will take more than a single scan, and so once activated they will require a delay
until they finish.

• To use the write functions we set up a block of memory, the function shows this starting at N9:0,
and it is 10 words long (this is determined by the special purpose card). The block transfer
function also needs a control block of memory, this is BT10:1

BT10:1/EN Advance Block Transfer Write


Module Type Example Output Card
Rack 00
Group 3
Module 0
Control Block BT10:1
Data File N9:0
Length 10
Continuous No

• To read values we use a similar method. In the example below 9 values will be read from the
card and be placed in memory locations from N9:4 to N9:11.
page 440

BT10:0/15 read BTR


Rack: 00
Group: 0
Module: 0
BT Array: BT10:0
Data File: N9:4
Length: 9
Continuous: no

24.3 DESIGN TECHNIQUES

24.3.1 State Diagrams

• We can implement state diagrams seen in earlier sections using many of the advanced function
discussed in this section.

• Most PLCs allow multiple programs that may be used as subroutines. We could implement a
block logic method using subroutine programs.

• Consider the state diagram below and implement it in ladder logic. You should anticipate what
will happen if both A and C are pushed at the same time.

STA STC
B D

A C

STB

first scan
page 441

PROGRAM 2
first scan
L STB

U STA

U STC

STA
JSR
program 3

STB
JSR
program 4

STC
JSR
program 5
page 442

PROGRAM 3
B
U STA

L STB

PROGRAM 4
C
U STB

L STC

A C
U STB

L STA
PROGRAM 5

D
U STC

L STB

MCR

24.4 DESIGN CASES

24.4.1 If-Then

• If-then can be implemented different ways, as a simple jump, or as a subroutine call.


page 443

A
JMP
LBL 01

IF (A) THEN GOTO (01)


01
LBL

A
JSR
FILE 3

IF (A) THEN {...... }

24.4.2 For-Next

• For-next can be implemented as shown below, but recall that PLC programs do not execute one
line at a time.
page 444

LIM
N7:0 MCR
min 1
max 10

for i = 1 to 10
next i
ADD
source A: N7:0
source B: 1
Dest.: N7:0

MCR

• A For/Next function is also available in the PLC.

• A do-while can be done as a simple variation of this.

24.4.3 Conveyor

• Consider a conveyor where parts enter on one end. they will be checked to be in a left or right
orientation with a vision system. If neither left nor right is found, he part will be placed in a
reject bin. The conveyor layout is shown below.

vision
left right reject

part movement
along conveyor

conveyor location sensor


page 445

24.5 FUNCTION REFERENCE

• The following function descriptions are for both the micrologix (500/1000) and PLC-5 proces-
sor families.

• Note that floating point operations are not available on the micrologix.

• Some of the flags referred to functions are:


S2:0/0 carry in math operation
S2:0/1 overflow in math operation
S2:0/2 zero in math operation
S2:0/3 sign in math operation

GENERAL FUNCTIONS

AFI - Always False Instruction

AFI

Description: Putting this instruction in a line will force the line to be false. This is prima-
rily designed for debugging programs.
Status Bits: none
Registers: none
Available on: Micrologix, PLC-5
page 446

MCR - Master Control Relay


A
MCR

MCR
Description: MCR instructions need to be used in pairs. If the first MCR line is true the
instructions up to the next MCR will be examined normally. If the first
MCR line is not true the outputs on the lines after will be FORCED
OFF. Be careful when using normal outputs in these blocks.
Status Bits: none
Registers: none
Available on: Micrologix, PLC-5

TIMERS

TON - Timer ON
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: This timer will delay turning on, but will turn off immediately. Once the
input turns on the accumulated value (ACC) will start to increase from
zero. When the preset (PRE) value is reached the DN bit is set. The done
bit will turn off and the accumulator will reset to zero if the input goes
false.
Status Bits: EN This bit is true while the input to the timer is true
TT This bit is true while the accumulator value is increasing
DN This bit is true when the accumulator value is equal to the preset
value
Registers: ACC The time that has passed since the input went true
PRE The maximum time delay before the timer goes on
Available on: Micrologix, PLC-5
page 447

TOF - Timer OFf


A TOF
TIMER OFF DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: This timer will delay turning off (the done bit, DN, will turn on immedi-
ately). Once the input turns off the accumulated value (ACC) will start
to increase from zero. When the preset (PRE) value is reached the DN
bit is turned off and the accumulator will reset to zero. If the input turns
on before the off delay is complete the accumulator will reset to zero.
Status Bits: EN This bit is true while the input to the timer is true
TT This bit is true while the accumulator value is increasing
DN This bit is true when the accumulator value is less than the preset
value and the input is true, or the accumulator is changing
Registers: ACC The time that has passed since the input went false
PRE The maximum time delay before the timer goes off
Available on: Micrologix, PLC-5
page 448

RTO - RetentiveTimer On
A RTO
RETENTIVE TIMER ON
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: This timer will delay turning on. When the input turns on the accumulated
value (ACC) will start to increase from zero. When the preset (PRE)
value is reached the DN bit is set. If the input goes false the accumulator
value is not reset to zero. To reset the timer and turn off the timer the
RES instruction should be used.
Status Bits: EN This bit is true while the input to the timer is true
TT This bit is true while the accumulator value is increasing
DN This bit is true when the accumulator value is less than the preset
value
Registers: ACC The time that has passed since the input went true
PRE The maximum time delay before the timer goes on
Available on: Micrologix, PLC-5

COUNTERS

• Counter memory instructions can share the same memory location, so some redundant bits are
mentioned here.
page 449

CTU - CounT Up
A CTU
COUNT UP
Counter C5:0
Preset 50
Accum. 0

Description: The counter accumulator will increase once each time the input goes from
false to true. If the accumulator value reaches the preset the done bit,
DN, will be set. The accumulator value will still increase even when the
done bit is set

Status Bits: CU Will be true when the input is true


CD Not used for this instruction
DN Will be set when ACC >= PRE
OV Will be set if the counter value has gone above 32,767
UN Not used for this instruction
Registers: ACC The total count
PRE The maximum count before the counter goes on
Available on: Micrologix, PLC-5
page 450

CTD - CounT Down


A CTD
COUNT DOWN
Counter C5:0
Preset 50
Accum. 0

Description: The counter accumulator will decrease once each time the input goes from
false to true. If the accumulator value reaches the preset the done bit,
DN, will be set. The accumulator value will still decrease even when the
done bit is set

Status Bits: CU Not used for this instruction


CD Will be true when the input is true
DN Will be set when ACC < PRE
OV Not used for this instruction
UN Will be set if the counter value has gone below -32,768
Registers: ACC The time that has passed since the input went true
PRE The maximum time delay before the timer goes on
Available on: Micrologix, PLC-5

COMPARE

LIM - LIMit
LIM
LIMIT TEST (CIRC) A
Low limit N7:0
Test N7:1
High Limit N7:2

Description: This function will check to see if a value is between two limits. If the
high limit is larger than the low limit and the test value is >= low limit
or <= high limit, then the output is true. If the low limit is higher than
the high limit, then a value not between the low and high limits will be
true.
Status Bits: none

Registers: none

Available on: Micrologix, PLC-5


page 451

MEQ - Masked EQual


MEQ
MASKED EQUAL A
Source N7:0
Mask N7:1
Compare N7:2

Description: The Source and Mask values are ANDed together. This will screenout
bits not on in the mask. The value is then compared to the ‘Compare’
value. If the values are equal, the output is true.
Status Bits: none

Registers: none

Available on: Micrologix, PLC-5

CMP - CoMPare
CMP
COMPARE A
Expression
“(N7:0 + 8) > N7:1”

Description: This function uses a free form expression to compare the two values. The
comparison values that are allowed include =, >, >=, <>, <, <=. The
expression must not be more than 80 characters long.
Status Bits: none

Registers: none
Available on: PLC-5
page 452

EQU, GEQ, GRT, LEQ, LES, NEQ


EQU
EQUALS A
Source A N7:0
Source B N7:1

Description: The basic compare has six variations. Each of these will look at the val-
ues in source A and B and check for the comparison case. If the com-
parison case is true, the output will be true. The types are,
EQU - Equals
GEQ - Greater than or equals
GRT - Greater than
LEQ - Less than or equals
LES - Less than
NEQ - Not equal
Status Bits: none

Registers: none
Available on: Micrologix, PLC-5

CALCULATION
page 453

ACS, ASN, ATN, COS, LN, LOG, NEG, SIN, SQR, TAN
A ACS
ARCCOSINE
Source N7:0
Dest N7:1

Description: These are unary math functions that will load a value from the source, do
the calculation indicated, and store the results in the destination. Func-
tions possible include
ACS - Arccosine (inverse cosine) in radians
ASN - Arcsine (inverse sine) in radians
ATN - Arctangent (inverse tangent) in radians
COS - Cosine using radians
LN - Natural Logarithm
LOG - Base 10 logarithm
NEG - Sign change from positive to negative, or reverse
SIN - Sine using radians
SQR - Square root
TAN - Tangent using radians

Status Bits: C Carry - set if a carry is generated


V Overflow - only set if value exceeds maximum for number type
Z Zero - sets if the result is zero.
S Sign - set if result is negative

Registers: none
Available on: Micrologix, PLC-5
page 454

ADD, DIV, MUL, SUB, XPY


A ADD
ADD
Source A N7:0
Source B N7:1
Dest N7:2
Description: These are binary math functions that will load two values from sources A
and B, do the calculation indicated, and store the results in the destina-
tion. Functions possible include
ADD - Add two numbers
DIV - Divide source A by source B
MUL - Multiply A and B
SUB - Subtract B from A
XPY - Raise X to the power of Y
Status Bits: C Carry - sets if a carry is generated
V Overflow - only set if value exceeds maximum for number type
Z Zero - sets if the result is zero.
S Sign - sets if the result is negative

Registers: none
Available on: Micrologix, PLC-5
page 455

AVE, STD
A AVE
AVERAGE FILE
File #N7:0
Dest N7:10
Control R6:0
Length 10
Postion 0
Description: These functions do the basic statistical calculations, average (AVE) and
standard deviation (STD). When the input goes from false to true the
calculation is begun. The values to be used for the calculation are
taken from the memory starting at the start of the file location, for the
length indicated. The final result is stored in the Dest. The control file
is used for the calculation to keep track of position, and indicate when
the calculation is done (it may take more than one PLC scan).

Status Bits: C Carry - always 0


V Overflow - only set if value exceeds maximum for number type
Z Zero - sets if the result is zero.
S Sign - sets if the result is negative
EN Enable - on when the instruction input is on
DN Done - set when the calculation is complete
ER Error - set if an error was encountered during calculation

Registers: none
Available on: Micrologix, PLC-5
page 456

SRT - SoRT
A SRT
SORT
File #N7:0
Control R6:0
Length 10
Position 0
Description: This functions sort the values in memory from lowest value in the first
location to the highest value. When the input goes from false to true
the calculation is begun. The values to be used for the calculation are
sorted in the memory starting at the start of the file location, for the
length indicated. The control file is used for the calculation to keep
track of position, and indicate when the calculation is done (it may
take more than one PLC scan).

Status Bits: EN Enable - on when the instruction input is on


DN Done - set when the calculation is complete
ER Error - set if an error was encountered during calculation
Registers: none
Available on: Micrologix, PLC-5

CLR - CLeaR
A CLR
CLR
Dest N7:0

Description: This value will clear a memory location by putting a zero in it when the
input to the function is true.
Status Bits: none

Registers: none
Available on: Micrologix, PLC-5
page 457

CPT - ComPuTe
A CPT
COMPUTE
Dest N7:0
Expression
“N7:1 - N7:3”

Description: This expression allows free-form entry of equations. A maximum of 80


characters is permitted. Operations allowed include +, -, | (divide), *,
FRD, BCD, SQR, AND, OR, NOT, XOR, ** (x**y = x to power y),
RAD, DEG, LOG, LN, SIN, COS, TAN, ASN, ACS, ATN

Status Bits: none

Registers: none
Available on: PLC-5

LOGICAL

AND, OR, XOR


A AND
BITWISE AND
Source A N7:0
Source B N7:1
Dest N7:2
Description: These functions do basic boolean operations to the numbers in locations
A and B. The results of the operation are stored in Dest. These calcu-
lations will be perform whenever the input is true. The functions are,
AND - Bitwise and
OR - Bitwise or
XOR - Bitwise exclusive or
Status Bits: C Carry - always 0
V Overflow - always 0
Z Zero - sets if the result is zero.
S Sign - sets if the MSB of the result is set

Registers: none
Available on: Micrologix, PLC-5
page 458

NOT
A NOT
NOT
Source N7:0
Dest N7:1
Description: This function will invert all of the bits in a word in memory whenever the
input is true.

Status Bits: C Carry - always 0


V Overflow - always 0
Z Zero - sets if the result is zero.
S Sign - sets if the MSB of the result is set

Registers: none
Available on: Micrologix, PLC-5

CONVERSION

FRD, TOD, DEG, RAD


A FRD
FROM BCD
Source N7:0
Dest N7:1
Description: This function will convert the value in the source location and store the
result in the Dest location. The functions possible include,
FRD - From BCD to a 2s compliment integer number
TOD - From 2s compliment integer number to BCD
DEG - Convert from radians to degrees
RAD - Convert from degrees to radians
Status Bits: C Carry - always 0
V Overflow - sets if an overflow as generated during conversion
Z Zero - sets if the result is zero.
S Sign - sets if the MSB of the result is set

Registers: none
Available on: Micrologix, PLC-5

MOVE
page 459

BTD - BiT Distribute


A BTD
BIT FIELD DISTRIB
Source N7:0
Source bit 0
Dest N7:1
Dest bit 4
Length 5

Description: This function will copy the bits starting at N7:0/0 to N7:1/4 for a length
of 5 bits.

Status Bits: none

Registers: none
Available on: Micrologix, PLC-5

MOV
A MOV
MOVE
Source N7:0
Dest N7:1
Description: This instruction will move values from one location to another, and if
necessary change value types, such as integer and floating point.

Status Bits: C Carry - always 0


V Overflow - Sets if an overflow occurred during conversion
Z Zero - sets if the result is zero.
S Sign - sets if the MSB of the result is set

Registers: none
Available on: Micrologix, PLC-5
page 460

MVM - MoVe Masked


A MVM
MAKSED MOVE
Source N7:0
Mask N7:1
Dest N7:2
Description: This function will retrieve the values from the source and mask memory
and AND them together. Only the bits that are true in the mask will be
copied to the new location.
Status Bits: C Carry - always 0
V Overflow - always 0
Z Zero - sets if the result is zero.
S Sign - sets if the MSB of the result is set

Registers: none
Available on: Micrologix, PLC-5

FILE
page 461

TON - Timer ON
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg

Status Bits: cf cfvgfdg

Registers: cf cfvgfdg

Available on: Micrologix, PLC-5

DIAGNOSTIC
page 462

DTR - Data TRansition


DTR
DATA TRANSITION A
Source N7:0
Mask 00FF
Reference N7:1
Description: This function will examine the source value and mask out bits using the
mask. The value will be compared to the Reference value, and if the
values agree, then the function will be true for one scan, after that it ill
be false.

Status Bits: none

Registers: none
Available on: Micrologix, PLC-5

SHIFT REGISTER

BSL, BSR
A BSL
BIT SHIFT LEFT
File #B3:0
Control R6:0
Bit Address I:0.0/0
Length 6
Description: These functions will shift bits through left or right through a string of bits
starting at #B3:0 with a length of 6 in the example above. As the bits
shift the bit shifted out will be put in the UL bit. A new bit will be
shifted into the vacant spot from the Bit Address. When the bits are
shifted they are moved in the memory locations starting at file #B3:0.
The two options available are:
BSR - Bit Shift Right
BSL - Bit Shift Left
Status Bits: EN Enable - is on when the input to the function is on
DN Done - is on when the shift operation is complete
ER Error - indicates when an error has occurred
UL Unload - the unloaded value is stored in this bit
Registers: none
Available on: Micrologix, PLC-5
page 463

FFL, FFU, LFL, LFU


A FFL
FIFO LOAD
Source N7:0
FIFO N7:10
Control R6:0
Length 10
Position 0

B FFU
FIFO UNLOAD
FIFO N7:10
Dest N7:11
Control R6:0
Length 10
Position 0
Description: Stack instructions will take integer words and store them, and then allow
later retrieval. The load instructions will store a value on the stack on a
false to true input change. The Unload instructions will remove a
value from that stack and store it in the Dest location. A Last On First
Off stack will return the last value pushed on. A First On First Off
stack will give the oldest value on the stack. If an attempt to load more
than the stack length, the values will be ignored. The instructions
available are:
FFL - FIFO stack load
FFU - FIFO stack unload
LFL - LIFO stack load
LFU - LIFO stack unload
Status Bits: EN Enable - is on when the input to the function is on
DN Done - is on when the shift operation is complete
ER Error - indicates when an error has occurred
UL Unload - the unloaded value is stored in this bit
Registers: none
Available on: Micrologix, PLC-5

SEQUENCERS
page 464

SQI - Sequencer Input


A SQI
SEQUENCER INPUT
File #N7:10
Mask FF00
Source N7:0
Control R6:0
Length 7
Position 0
Description: This will compare a source value to a set of values in a sequencer table.

Status Bits: none


Registers: none none

Available on: Micrologix, PLC-5

SQL - SeQuencer Load


A SQL
SEQUENCER LOAD
File #N7:10
Source N7:0
Control R6:0
Length 6
Position 0
Description: When the input goes from false to true the value at the source will be
loaded into the sequencer. After the position has reached the length
the following values will be ignored, and the done bit will be set.
Status Bits: EN Enable - will be true when the input to the function is true
DN Done - will be set when the sequencer is fully loaded
ER Error - will be set when there has been an error

Registers: none
Available on: Micrologix, PLC-5
page 465

SQO - SeQuencer Output


A SQO
SEQUENCER OUTPUT
File #N7:10
Mask FF00
Dest N7:0
Control R6:0
Length 6
Position 0

Description: When the input goes from false to true the sequencer will output a value
from a new position in the sequencer table. After the position has
reached the length the sequencer will reset to position 1. Note that the
first entry in the sequencer table will only be output the first time the
function is un, or if reset has been used.
Status Bits: EN Enable - will be true when the input to the function is true
DN Done - will be set when the sequencer is fully loaded
ER Error - will be set when there has been an error

Registers: none
Available on: Micrologix, PLC-5

PROGRAM CONTROL
page 466

FOR/NXTBRK
A FOR
FOR
Label Number 0
Index N7:0
Initial Value 0
Terminal Value 10
Step Size 2

B
BRK

C NXT
NEXT
Label Number 0

Description: This instruction will create a loop like traditional programming lan-
guages with a start and end value with a step size for each loop.
Instructions between the FOR and NXT will be repeated. If the line
with the BRK statement becomes true, the NXT command will be
ignored.
Status Bits: none

Registers: none

Available on: Micrologix, PLC-5


page 467

JSR/SBR/RET
A JSR
JUMP TO SUBROUTINE
Program File 3
Input par N7:0
Input par N7:1
Return par N7:10
Return par N7:11
Return par N7:12

B SBR
SUBROUTINE
Input par N7:20
Input par N7:21

C RET
RETURN()
Return par N7:22
Return par N7:23
Return par N7:24
Description: The JSR will jump to another program file and pass a list of arguments
that can be a variable length. The first statement in the subroutine pro-
gram file should be SBR to retrieve the arguments passed. The sub-
routine will end with the RET command that will go back to where the
JSR function was encountered. The RET function can return a vari-
able number of arguments.
Status Bits: none

Registers: none

Available on: Micrologix, PLC-5

PROCESS CONTROL AND MESSAGES


page 468

PID -
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg

Status Bits: cf cfvgfdg

Registers: cf cfvgfdg

Available on: Micrologix, PLC-5

BLOCK TRANSFER
page 469

BTW
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg

Status Bits: cf cfvgfdg

Registers: cf cfvgfdg

Available on: Micrologix, PLC-5

ASCII
page 470

AWT -
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg

Status Bits: cf cfvgfdg

Registers: cf cfvgfdg

Available on: Micrologix, PLC-5


page 471

24.6 PRACTICE PROBLEMS

1. A switch will turn a counter on when engaged. This counter can be reset by a second switch.
The value in the counter should be multiplied by 5, and then displayed as a binary output using
(201-208)

2. Develop Ladder Logic for a car door/seat belt safety system. When the car door is open, or the
seatbelt is not done up, the ignition power must not be applied. In addition the key must be able
to switch ignition power.

1. List of Inputs

2. Draw Ladder

3. TRUE / FALSE -- PLC outputs can be set with Bytes instead of bits.

(ans. true)

4. Create a ladder logic program that will start when input ‘A’ is turned on and calculate the series
below. The value of ‘n’ will start at 1 and with each scan of the ladder logic ‘n’ will increase until
n=100. While the sequence is being incremented, any change in ‘A’ will be ignored.

x = 2(n – 1 ) A = I:000/00
n = N7:0
x = N7:1
page 472

ans.
A B3:0
MOV
Source A 1
Dest. N7:0
A
B3:0
LEQ
Source A N7:0
B3:0 Source B 100

B3:0
CPT
Dest. N7:1
Expression
2 * (N7:0 - 1)

B3:0
ADD
Source A 1
Source B N7:0
Dest. N7:0

5. A thumbwheel input card acquires a four digit BCD count. A sensor detects parts dropping
down a chute. When the count matches the BCD value the chute is closed, and a light is turned
on until a reset button is pushed. A start button must be pushed to start the part feeding.
Develop the ladder logic for this controller. Use a structured design technique such as a state
diagram.

INPUT OUTPUT

I:000 - BCD input card O:002/00 - chute open


I:001/00 - part detect O:002/01 - light
I:001/01 - start button
I:001/02 - reset button
page 473

first scan
ans.

S1 start S2
parts
waiting counting
(chute open)

count
S3 exceeded
reset bin
full
(light on)
page 474

first scan
L S1

U S2

U S3

S2
chute

S3
light

S1
MCR

start
L S2

U S1

FRD
Source A I:000
Dest. C5:0/ACC

MCR
page 475

S2
MCR

part detect
CTD
counter C5:0
preset 0
C5:0/DN
L S3

U S2

MCR

S3
MCR

reset
L S1

U S3

MCR

6. Design and write ladder logic for a simple traffic light controller that has a single fixed
sequence of 16 seconds for both green lights and 4 second for both yellow lights. Use either stacks
or sequencers.
page 476

ans. (the sequencer is best suited to this problem) OUTPUTS


T4:0/DN O:000/00 NSG - north south green
O:000/01 NSY - north south yellow
TON O:000/02 NSR - north south red
T4:0 O:000/03 EWG - east west green
preset 4.0 sec O:000/04 EWY - east west yellow
T4:0/DN O:000/05 EWR - east west red
SQO
File #N7:0 Addr. Contents (in binary)
mask 003F
Dest. O:000 N7:0 0000000000100001
Control R6:0 N7:1 0000000000100001
Length 10 N7:2 0000000000100001
N7:3 0000000000100001
N7:4 0000000000100010
N7:5 0000000000001100
N7:6 0000000000001100
N7:7 0000000000001100
N7:8 0000000000001100
N7:9 0000000000010100

7. A PLC is to be used to control a carillon (a bell tower). Each bell corresponds to a musical note
and each has a pneumatic actuator that will ring it. The table below defines the tune to be pro-
grammed. Write a program that will run the tune once each time a start button is pushed. A
stop button will stop the song.

time sequence in seconds

O:000/00 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
O:000/00 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
O:000/01 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
O:000/02 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0
O:000/03 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0
O:000/04 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
O:000/05 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
O:000/06 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0
O:000/07 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0

8. The following program uses indirect addressing. Indicate what the new values in memory will
be when button A is pushed after the first and second instructions.
page 477

A
ADD
Source A 1
Source B N7:0
Dest. N7:[N7:1]

A
ADD
Source A N7:[N7:0]
Source B N7:[N7:1]
addr before after 1st after 2nd Dest. N7:[N7:0]
N7:0 1
N7:1 2
N7:2 3

9.
page 478

25. PLC PROGRAMMING

25.1 PROGRAMMING STANDARDS

25.1.1 IEC 1131

• The IEC 1131 standard is an effort towards standardizing PLC oriented control. This is more
necessary now that personal computers and software are starting to open the PLC market.

• These standards were not designed to force a rigid style, so the different PLC vendors will still
have programming environments that vary, but the conceptual elements will be consistent.

• The most notable differences between implementation of PLCs will be addresses of outputs,
inputs, internal memory, etc.

• There are a few components to the standard,


IEC 1131-3 Data types and programming
IEC 1131-5 Communications
IEC 1131-7 Fuzzy control

• IEC 1131-3 defines the basic programming languages,


IL (Instruction List) - This is effectively mnemonic programming
ST (Structured Text) - A BASIC like programming language
LD (Ladder Diagram ) - Relay logic diagram based programming
FBD (Function Block Diagram) - A graphical dataflow programming method
SFC (Sequential Function Charts) - A graphical method for structuring programs

• Many of the functions described in this note set support the standard.

• The standard also defines data types,


page 479

Name Type Bits Range

BOOL boolean 1 0 to 1
SINT short integer 8 -128 to 127
INT integer 16 -32768 to 32767
DINT double integer 32 -2.1e-9 to 2.1e9
LINT long integer 64 -9.2e19 to 9.2e19
USINT unsigned short integer 8 0 to 255
UINT unsigned integer 16 0 to 65536
UDINT unsigned double integer 32 0 to 4.3e9
ULINT unsigned long integer 64 0 to 1.8e20
REAL real numbers 32
LREAL long reals 64
TIME duration not fixed not fixed
DATE date not fixed not fixed
TIME_OF_DAY, TOD time not fixed not fixed
DATE_AND_TIME, DT date and time not fixed not fixed
STRING string variable variable
BYTE 8 bits 8 NA
WORD 16 bits 16 NA
DWORD 32 bits 32 NA
LWORD 64 bits 64 NA

25.1.2 The Future of Open Architecture Controllers

• a PLC is not simply a computer. It contains a computer, with special interfacing abilities. But the
programming environment is like the Java Virtual Machine. The programs are interpreted
within the ladder logic model. Some features are not available, while others are enhanced.

• Each PLC vendor has developed one or more different PLC models that bare some similarity at
the level of basic inputs and outputs. To unite these models there has been recent work to
develop a common standard so that all PLCs are similar (IEC 1131) but this is not to the point
where it will free the user from a single vendor.

• At the present time inputs and outputs are becoming more flexible, but the central computation
controller (PLC CPU) is still vendor specific. Consider that you can write a program in Java
that will compile on dozens of java compilers.

• There are two possible directions that this might go,


- some third party companies are developing products that are based on other companies
page 480

models, such as SoftPLC being based on the PLC-5


- a standards group may be able to develop a standard addressing and instruction set. And
a common execution model may also be developed that will allow vendors to
develop a common engine.

25.2 PRACTICE PROBLEMS


page 481

26. STRUCTURED TEXT PROGRAMMING

• This is a procedural programming language that resembles BASIC, and will be comfortable for
those that have learned other programming languages such as C, Fortran, Pascal, etc.

26.1 INTRODUCTION

• The language was developed to meet the IEC 1131-3 standard.

• A simple program to count from 1 to 10 is shown below,

N7:0 := 0
REPEAT
N7:0 := N7:0 + 1;
UNTIL N7:0 >= 10
END_REPEAT;

26.2 THE LANGUAGE

• These programs can also coexist with ladder logic programs. This gives the ability to get solu-
tions that are the best of both worlds.

• Some general notes about the language are,


- The language can use normal I/O or memory values as well as named variables.
- Separate operators with spaces; when in doubt use spaces. Indents will also make the
program more readable.
- Comments will be on lines that start with ‘%’.
- Semicolons are used at the end of instructions - this does not mean every line.
- the instructions can be upper or lower case.
- instructions can be nested.
-

• Remember - unlike normal programming languages these programs must run and then stop each
ladder logic scan.

• Variable names can be anything but those listed below, and the other instruction names.
page 482

Invalid variable names: START, DATA, PROJECT, SFC, SFC2, LADDER, I/O, ASCII,
CAR, FORCE, PLC2, CONFIG, INC, ALL, YES, NO, STRUCTURED TEXT

Valid memory/variable name examples: TESTER, I, I:000, I:000/00, T4:0, T4:0/DN,


T4:0.ACC

• Variables are defined with the following keywords.

Declaration Description

VAR the general variable declaration


VAR_INPUT defines a variable list for a function
VAR_OUTPUT defines output variables from a function
VAR_IN_OUT defines variable that are both inputs and outputs from a function
VAR_EXTERNAL
VAR_GLOBAL a global variable
VAR_ACCESS
RETAIN a value will be retained when the power is cycled
CONSTANT a value that cannot be changed
AT can tie a variable to a specific location in memory (without this vari-
able locations are chosen by the compiler

• Examples of variable declarations are given below,


page 483

Text Program Line Description

VAR AT %B3:0 : WORD; END_VAR a word in bit memory


VAR AT %N7:0 : INT; END_VAR an integer in integer memory
VAR RETAINAT %O:000 : WORD ; END_VAR makes output bits retentive
VAR_GLOBAL A AT %I:000/00 : BOOL ; END_VAR variable ‘A’ as input bit
VAR_GLOBAL A AT %N7:0 : INT ; END_VAR variable ‘A’ as an integer
VAR A AT %F8:0 : ARRAY [0..14] OF REAL; END_VAR an array ‘A’ of 15 real values
VAR A : BOOL; END_VAR a boolean variable ‘A’
VAR A, B, C : INT ; END_VAR integers variables ‘A’, ‘B’, ‘C’
VAR A : STRING[10] ; END_VAR a string ‘A’ of length 10
VAR A : ARRAY[1..5,1..6,1..7] OF INT; END_VAR a 5x6x7 array ‘A’ of integers
VAR RETAIN RTBT A : ARRAY[1..5,1..6] OF INT; a 5x6 array of integers, filled
END_VAR with zeros after power off
VAR A : B; END_VAR ‘A’ is data type ‘B’
VAR CONSTANT A : REAL := 5.12345 ; END_VAR a constant value ‘A’
VAR A AT %N7:0 : INT := 55; END_VAR ‘A’ starts with 55
VAR A : ARRAY[1..5] OF INT := [5(3)]; END_VAR ‘A’ starts with 3 in all 5 spots
VAR A : STRING[10] := ‘test’; END_VAR ‘A’ contains ‘test’ initially
VAR A : ARRAY[0..2] OF BOOL := [1,0,1]; END_VAR an array of bits
VAR A : ARRAY[0..1,1..5] OF INT := [5(1),5(2)]; an array of integers filled with 1
END_VAR for [0,x] and 2 for [1,x]

• Basic numbers are shown below. Note the underline ‘_’ can be ignored, it can be used to break
up long numbers, ie. 10_000 = 10000.

number type examples

integers -100, 0, 100, 10_000


real numbers -100.0, 0.0, 100.0, 10_000.0
real with exponents -1.0E-2, -1.0e-2, 0.0e0, 1.0E2
binary numbers 2#111111111, 2#1111_1111, 2#1111_1101_0110_0101
octal numbers 8#123, 8#777, 8#14
hexadecimal numbers 16#FF, 16#ff, 16#9a, 16#01
boolean 0, FALSE, 1, TRUE

• Character strings are shown below.


page 484

example description

‘’ a zero length string


‘ ‘, ‘a’, ‘$’’, ‘$$’ a single character, a space, or ‘a’, or a single quote, or a dollar
sign $
‘$R$L’, ‘$r$l’,‘$0D$0A’ produces ASCII CR, LF combination - end of line characters
‘$P’, ‘$p’ form feed, will go to the top of the next page
‘$T’, ‘4t’ tab
‘this%Tis a test$R$L’ a string that results in ‘this<TAB>is a test<NEXT LINE>’

• Basic time duration values are described below.

Time Value Examples

25ms T#25ms, T#25.0ms, TIME#25.0ms, T#-25ms, t#25ms


5.5hours TIME#5.3h, T#5.3h, T#5h_30m, T#5h30m
3days, 5hours, 6min, 36sec TIME#3d5h6m36s, T#3d_5h_6m_36s

• Date values are given below. These are meant to be used to compare to system time and date
clocks.

description examples

date values DATE#1996-12-25, D#1996-12-25


time of day TIME_OF_DAY#12:42:50.92, TOD#12:42:50.92
date and time DATE_AND_TIME#1996-12-25-12:42:50.92, DT#1996-12-25-12:42:50.92

• Basic math functions include,


page 485

:= assigns a value to a variable


+ addition
- subtraction
/ division
* multiplication
MOD(A,B) modulo - this provides the remainder for an integer divide A/B
SQR(A) square root of A
FRD(A) from BCD to decimal
TOD(A) to BCD from decimal
NEG(A) reverse sign +/-
LN(A) natural logarithm
LOG(A) base 10 logarithm
DEG(A) from radians to degrees
RAD(A) to radians from degrees
SIN(A) sine
COS(A) cosine
TAN(A) tangent
ASN(A) arcsine, inverse sine
ACS(A) arccosine - inverse cosine
ATN(A) arctan - inverse tangent
XPY(A,B) A to the power of B
A**B A to the power of B

• Functions for logical comparison include,

> greater than


>= greater than or equal
= equal
<= less than or equal
< less than
<> not equal

• Functions for Boolean algebra and logic include,


page 486

AND(A,B) logical and


OR(A,B) logical or
XOR(A,B) exclusive or
NOT(A) logical not
! logical not

• The precedence of operations are listed below from highest to lowest. As normal expressions
that are the most deeply nested between brackets will be solved first. (Note: when in doubt use
brackets to ensure you get the sequence you expect.)

!
()
XPY, **
SQR, TOD, FRD, NOT, NEG, LN, LOG, DEG, RAD, SIN, COS, TAN, ASN, ACS, ATN
*, /, MOD
highest priority

+, -
AND (for word)
XOR (for word)
OR (for word)
>, >=, =, <=, <, <>
AND (bit)
XOR (bit)
OR (bit)
ladder instructions

• Language structures include those below,

IF-THEN-ELSIF-ELSE-END_IF; normal if-then structure


CASE-value:-ELSE-END_CASE; a case switching function
FOR-TO-BY-DO-END_FOR; for-next loop
WHILE-DO-END_WHILE;

• Special instructions include those shown below.


page 487

RETAIN() causes a bit to be retentive


IIN(); immediate input update
EXIT; will quit a FOR or WHILE loop
EMPTY

• Consider the program below to find the average of five values in floating point memory.

F8:10 := 0;
FOR (N7:0 := 0 TO 4) DO
F8:10 := F8:10 + F8:[N7:0];
END_FOR;

• Consider the program below to find the average of five values in floating point memory.

F8:10 := 0;
WHILE (N7:0 < 5) DO
F8:10 := F8:10 + F8:[N7:0];
N7:0 := N7:0 + 1;
END_WHILE;

• The example below will set different outputs depending upon the stat of an input.

IF (I:000/00 = 1) THEN
O:001/00 := 1;
ELSIF (I:000/01 = 1 AND T4:0/DN = 1) THEN
O:001/00 := 1;
IF (I:000/02 = 0) THEN
O:001/01 := 1;
END_IF;
ELSE
O:001/01 := 1;
END_IF;
page 488

• The example below will set output bits 00-03 depending upon the value of the integer in N7:0, if
the value is not between 0 and 3 the outputs will all go off.

CASE N7:0 OF
0:
O:000/00 := 1;
1:
O:000/01 := 1;
2:
O:000/02 := 1;
3:
O:000/03 := 1;
ELSE
O:000 := 0;
END_CASE;

• The example below accepts a BCD input from (I:000) and will use it to change the delay time
for an on delay timer that will examine input I:002/00 drive output O:001/00.

FRD (I:000, DELAY_TIME);


IF (I:002/00) THEN
TON (T4:0, 1.0, DELAY_TIME, 0);
ELSE
RES (T4:0);
END_IF;
O:001/00 := T4:0.DN;

• Try the example below,


page 489

Write a structured text program to control a press that has an advance and retract with
limit switches. The press is started and stopped with start and stop buttons.

• Normal ladder logic output functions can be used except for those listed below.

not valid output functions: JMP, END, MCR, FOR, BRK, NXT, MSG, SDS, DFA, AND,
OR, XOR, TND
valid output functions include: OTL, OTU, OTE, TON, TOF, RTO, CTU, CTD, RES,
ADD, SUB, MUL, DIV, etc...

• The list below gives a most of the IEC1131-3 defined functions with arguments. Some of the
functions can be overloaded (for example ADD could have more than two values to add), and
others have optional arguments. In most cases the optional arguments are things line preset val-
ues for timers. When arguments are left out they default to values, typically 0.
page 490

Function Description

ABS(A); absolute value of A


ACOS(A); the inverse cosine of A
ADD(A,B,...); add A+B+...
AND(A,B,...); logical and of inputs A,B,...
ASIN(A); the inverse sine of A
ATAN(A); the inverse tangent of A
BCD_TO_INT(A); converts a BCD to an integer
CONCAT(A,B,...); will return strings A,B,... joined together
COS(A); finds the cosine of A
CTD(CD:=A,LD:=B,PV:=C); down counter active <=0, A decreases, B loads preset
CTU(CU:=A,R:=B,PV:=C); up counter active >=C, A decreases, B resets
CTUD(CU:=A,CD:=B,R:=C,LD: up/down counter combined functions of the up and
=D,PV:=E); down counters
DELETE(IN:=A,L:=B,P:=C); will delete B charaters at position C in string A
DIV(A,B); A/B
EQ(A,B,C,...); will compare A=B=C=...
EXP(A); finds e**A where e is the natural number
EXPT(A,B); A**B
FIND(IN1:=A,IN2:=B); will find the start of string B in string A
F_TRIG(A); a falling edge trigger
GE(A,B,C,...); will compare A>=B, B>=C, C>=...
GT(A,B,C,...); will compare A>B, B>C, C>...
INSERT(IN1:=A,IN2:=B,P:=C); will insert string B into A at position C
INT_TO_BCD(A); converts an integer to BCD
INT_TO_REAL(A); converts A from integer to real
LE(A,B,C,...); will compare A<=B, B<=C, C<=...
LEFT(IN:=A,L:=B); will return the left B characters of string A
LEN(A); will return the length of string A
LIMIT(MN:=A,IN:=B,MX:=C); checks to see if B>=A and B<=C
LN(A); natural log of A
LOG(A); base 10 log of A
LT(A,B,C,...); will compare A<B, B<C, C<...
page 491

Function Description

MAX(A,B,...); outputs the maximum of A,B,...


MID(IN:=A,L:=B,P:=C); will return B characters starting at C of string A
MIN(A,B,...); outputs the minimum of A,B,...
MOD(A,B); the remainder or fractional part of A/B
MOVE(A); outputs the input, the same as :=
MUL(A,B,...); multiply values A*B*....
MUX(A,B,C,...); the value of A will select output B,C,...
NE(A,B); will compare A <> B
NOT(A); logical not of A
OR(A,B,...); logical or of inputs A,B,...
REAL_TO_INT(A); converts A from real to integer
REPLACE(IN1:=A,IN2:=B,L:= will replace C characters at position D in string A with
C,P:=D); string B
RIGHT(IN:=A,L:=B); will return the right A characters of string B
ROL(IN:=A,N:=B); rolls left value A of length B bits
ROR(IN:=A,N:=B); rolls right value A of length B bits
RS(A,B); RS flip flop with input A and B
RTC(IN:=A,PDT:=B); will set and/or return current system time
R_TRIG(A); a rising edge trigger
SEL(A,B,C); if a=0 output B if A=1 output C
SHL(IN:=A,N:=B); shift left value A of length B bits
SHR(IN:=A,N:=B); shift right value A of length B bits
SIN(A); finds the sine of A
SQRT(A); square root of A
SR(S1:=A,R:=B); SR flipflop with inputs A and B
SUB(A,B); A-B
TAN(A); finds the tangent of A
TOF(IN:=A,PT:=B); off delay timer
TON(IN:=A,PT:=B); on delay timer
TP(IN:=A,PT:=B); pulse timer - a rising edge fires a fixed period pulse
TRUNC(A); converts a real to an integer, no rounding
XOR(A,B,...); logical exclusive or of inputs A,B,...
page 492

• Try the example below,

Write a structured text program to sort a set of ten integer numbers and then find the
median value.

• We can define functions that return single values,


page 493

....
D := TEST(1.3, 3.4); (* sample calling program, here C will default to 3.14 *)
E := TEST(1.3, 3.4, 6.28); (* here C will be given a new value *)
....

FUNCTION TEST : REAL


VAR_INPUT A, B : REAL; C : REAL := 3.14159; END VAR
TEST := (A + B) / C;
END_FUNCTION

• Try the example below using a function or subroutine,

Write a structured text program control a set of traffic lights.


page 494

26.3 PRACTICE PROBLEMS

1. Write logic for a traffic light controller using structured text.


page 495

27. INSTRUCTION LIST PROGRAMMING

• This is the most basic form of PLC programming that most resembles assembly language pro-
gramming.

• Until recently this was the most common programming form, but the advances in computer
graphics in the 1980s made graphical programming languages (ladder logic) more popular.

27.1 INTRODUCTION

• This graphical language is part of the IEC 1131-3 standard.

• A simple example is given below.

Label Opcode Operand Comment

START: LD %I:000/00 (* Load input bit 00 *)


AND( %I:000/01 (* Start a branch and load input bit 01 *)
OR( %I:000/02 (* Load input bit 02 *)
AND %I:000/03 (* Load input bit 03 and invert *)
)
)
ST %O:001/00 (* SET the output bit 00 *)

read as O:001/00 = I:000/00 AND ( I:000/01 OR ( I:000/02 AND I:000/03) )

I:000/00 I:000/01
O:001/00
I:000/02 I:000/03

• A list of common mnemonics is given below. These include both the IEC 1131-3 values, and
those specific to Allen Bradley controllers.
page 496

Basic Mnemonics Ladder Equivalents

x
XIC x (examine on)
LD x (load)

x
XIO x (examine if closed)
LD NOT x (load not)

x y
AND y

x
OR y
y

x
OTE x (output enable)

** The operands ‘x’ and ‘y’ are a function of specific PLC’s I/O addressing schemes.

Note: the PLC works with a logical stack (like an HP calculator). Each operation
can put true false values on the stack and/or pull them off. When done the out-
put should be the last operation that pulls off a single true/false value. When
there are branches in the ladder logic, more values will be on the stack.

Other Allen Bradley mnemonics include,


OTL (output latch)
OTU (output unlatch)
TOF (timer off)
TON (timer on)
CTD (count down)
CTU (count up)

• A list of the official IEC 1131-3 mnemonics is given below,


page 497

Operator Modifiers Data Types Description

LD N many set current result to value


ST N many store current result to location
S, R BOOL set or reset a value (latches or flip-flops)
AND, & N, ( BOOL boolean and
OR N, ( BOOL boolean or
XOR N, ( BOOL boolean exclusive or
ADD ( many mathematical add
SUB ( many mathematical subtraction
MUL ( many mathematical multiplication
DIV ( many mathematical division
GT ( many comparison greater than >
GE ( many comparison greater than or equal >=
EQ ( many comparison equals =
NE ( many comparison not equal <>
LE ( many comparison less than or equals <=
LT ( many comparison less than <
JMP C, N LABEL jump to LABEL
CAL C, N NAME call subroutine NAME
RET C, N return from subroutine call
) get value from stack

• Here there are three types of modifiers,


N - negates an input or output
( - nests an operation and puts it on a stack to be pulled off by )
C - forces a check for the currently evaluated results

• This language uses a stack structure, like an HP calculator. When the open brackets are used the
operations are pushed on the stack, closed brackets pull them back off.

• An example of an instruction language subroutine is given below. This program will examine a
BCD input on card I:000, and if it becomes higher than 100 then 2 seconds later output O:001/
00 will turn on.
page 498

Program File 2:

Label Opcode Operand Comment

START: CAL 3 (* Jump to program file 3 *)

Program File 3:

Label Opcode Operand Comment

TEST: LD %I:000 (* Load the word from input card 000 *)


BCD_TO_INT (* Convert the BCD value to an integer *)
ST %N7:0 (* Store the value in N7:0 *)
GT 100 (* Check for the stored value (N7:0) > 100 *)
JMPC ON (* If true jump to ON *)
CAL RES(C5:0) (* Reset the timer *)
ON: LD 2 (* Load a value of 2 - for the preset *)
ST %C5:0.PR (* Store 2 in the preset value *)
CAL TON(C5:0) (* Update the timer *)
LD %C5:0.DN (* Get the timer done condition bit *)
ST %O:001/00 (* Set the output bit *)
RET (* Return from the subroutine *)

27.2 PRACTICE PROBLEMS

6. Write the ladder diagram programs that correspond to the following Boolean programs.
page 499

LD 001 LD NOT 001


LD 001 AND 002 AND 002
OR 003 LD 004 LD 004
LD 002 AND 005 OR 007
OR 004 OR LD AND 005
AND LD OR 007 OR LD
LD 005 LD 003 LD 003
OR 007 OR NOT 006 OR NOT 006
AND 006 AND LD AND LD
OR LD OR NOT 008
OUT 204 OUT 204
AND 009
OUT 206
AND NOT 010
OUT 201
page 500

28. FUNCTION BLOCK PROGRAMMING

• This is a procedural programming language that resembles block diagrams. To date this has been
primarily popularized by programs such as Labview.

28.1 INTRODUCTION

• This graphical language is part of the IEC 1131-3 standard.

• An example is given below.

N7:0 SIN

* A<B O:000/01

N7:1
LN

N7:2

• There are different data types for the connection lines.

• Inputs and outputs can be negated by adding a inverting input or output.

• The functions in the diagrams are based on the other functions available. The inputs to a func-
tion enter on the left of the block, and the outputs of the function emerge from the right.
page 501

Structural Text Function Function Block Equivalent

A O
O := ADD(A, B); ADD
B

• Some functions can have a variable number of arguments. Here there is a third value input to the
add block. This is known as overloading.

Structural Text Function Function Block Equivalent

A O
O := ADD(A, B, C); ADD
B
C

• The ADD function in the example must always have the same inputs, other functions may have
variable numbers of arguments.

Structural Text Function Function Block Equivalent

A MN O
O := LIM(MN := A, IN := B, MX := C); LIM
B IN
C MX

O := LIM(MN := A, IN := B); A MN LIM O


B IN

• The tables of

28.2 PRACTICE PROBLEMS


page 502

1.
page 503

29. ANALOG INPUTS AND OUTPUTS

• Interfacing for Acquisition of Signals from Sensors and Generation of Signals for Actuators

• Used by Computers, PLC’s, PID Controllers, etc.

• Computers are designed to handle both input and output (I/O) data

• Two main types of data I/O for computers


• Analog
• Digital

Voltage
analog

digital

29.1 ANALOG INPUTS

• A Continuous signal is sampled by the computer

• The computer uses approximation techniques to estimate the analog value during the sampling
window.

• An example of an A/D, D/A control of a process is shown below


page 504

Analog
to Digital Amp
Converter

CPU Water
Running Supply
Control
Program

Analog
to Digital Amp
Converter Water Tank

pressure
transducer

• Multiplexers are used when a number of signals are to be input to a single A/D converter. This
allows each of a number of channels to be sampled, one at a time

• Signal conditioners are often to amplify, or filter signals coming from transducers, before they
are read by the A/D converter.

• Output drivers and amplifiers are often required to drive output devices when using D/A

• Sampling problems occur with A/D conversion. Because readings are taken periodically (not
continually), the Nyquist criterion specifies that sampling frequencies should be twice the fre-
quency of the signal being measured, otherwise aliasing will occur.

• Since the sampling window for a signal is short, noise will have added effect on the signal read.
For example, a momentary voltage spike might result in a higher than normal reading.

• When an analog value is converted to or from digital values, a quantization error is involved.
The digital numbering scheme means that for an 8 bit A/D converter, there is a resolution of
256 values between maximum and minimum. This means that there is a round off error of
approximately 0.4%.
page 505

Voltage is sampled during these time periods

voltage

time

(Sampling Frequency)-1 Sampling time

29.1.1 Analog To Digital Conversions

• When there are analog values outside a computer, and we plan to read these to digital values,
there are a variety of factors to consider,
- when the sample is requested, a short period of time passes before the final sample value
is obtained.
- the sample value is ‘frozen’ after a sample interval.
- after the sample is taken, the system may change
- sample values can be very sensitive to noise
- the continuous values of the signal loose some accuracy when conversion to a digital
number

• Consider the conversion process pictured below,


page 506

V(t)
V max

V2

V1

V min

t
τ
t1 t2
where,
V ( t ) = the actual voltage over time
τ = sample interval for A/D converter
t = time
t 1, t 2 = time at start,end of sample
V 1, V2 = voltage at start, end of sample
V min, V max = input voltage range of A/D converter
N = number of bits in the A/D converter

• Once this signal is processes through a typical A/D converter we get the following relations
(these may vary slightly for different types of A/D converters).
page 507

N
R = 2
V in – V min
V I = INT  ----------------------------- R
V max – V min

VI
V C =  ----- ( V max – V min ) + V min
 R
V max – V min
V ERROR =  -----------------------------
 2R 

where,
R = resolution of A/D converter
V I = the integer value representing the input voltage
V C = the voltage calculated from the integer value
V ERROR = the maximum quantization error

• Consider the example,

We are given a 12 bit analog input with a range of -10V to 10V. If we put in 2.735V, what
will the integer value be after the A/D conversion? What is the error? What voltage can
we calculate?

• In most applications a sample is taken at regular intervals, with a period of ‘T’ seconds.

• In practice the sample interval is kept as small as possible. (i.e., tau << T)

• If we are sampling a periodic signal that changes near or faster that the sampling rate, there is a
chance that we will get a signal that appears chaotic, or seems to be a lower frequency. This
phenomenon is known as aliasing.
page 508

• Quite often an A/D converter will multiplex between various inputs. As it switches the voltage
will be sampled by a ‘sample and hold circuit’. This will then be converted to a digital value.
The sample and hold circuits can be used before the multiplexer to collect data values at the
same instant in time.

• A simple type of A/D converter is shown below. It is known as a successive approximation type.

Vin above (+ve) or below (-ve) Ve

Vin
+
-
+Vref

successive 8
approximation D to A
clock converter
logic Ve

reset done

-Vref 8
data out

This device is an 8 bit converter. The main concept behind this is the successive approxi-
mation logic. Once the reset is toggled the converter will start by setting the most sig-
nificant bit of the 8 bit number. This will be converted to a voltage ‘Ve’ that is a
function of the ‘+/-Vref’ values. The value of ‘Ve’ is compared to ‘Vin’ and a simple
logic check determines which is larger. If the value of ‘Ve’ is larger the bit is turned off.
The logic then repeats similar steps from the most to least significant bits. Once the last
bit has been set on/off and checked the conversion will be complete, and a done bit can
be set to indicate a valid conversion value.

29.1.2 Analog Inputs With a PLC

• To input analog values into a PLC we use the block transfer commands. These allow control
information to the input card and retrieve results.

• The example below shows ladder logic to do an analog input.


page 509

BT10:0/EN BTR
Rack: 0
Group: 0
Module: 0
BT Array: BT10:0
Data File: N7:10
Length: 20
Continuous: no

input BTW
BT10:1/EN
Rack: 0
Group: 0
Module: 0
BT Array: BT10:1
Data File: N7:30
Length: 37
S2:1/14 Continuous: no

The basic operation is that the BTW will send the control block to the input card.
The inputs are used because the BTR and BTW commands may take longer than
one scan.

• The block that needs to be written to an 1771-IFE analog input card is shown below. This is a 12
bit card, so the range will have up to 2**12 = 4096 values.
page 510

N7:30 0
R8 R8 R7 R7 R6 R6 R5 R5 R4 R4 R3 R3 R2 R2 R1 R1

1 R16 R16 R15 R15 R14 R14 R13 R13 R12 R12 R11 R11 R10 R10 R9 R9

2 S S S S S N N T F F F F F F F F
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3
Note: lines 3-36 allow data scaling so that
the inputs can be automatically converted
to a voltage, or other value. If the values
are left at 0, scaling is turned off.

36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

R1,R2,...R16 - range values 00 1 to 5V


01 0 to 5V
10 -5 to 5V
11 -10 to 10V

T - input type - (0) gives single ended, (1) gives double ended

N - data format - 00 BCD


01 not used
10 2’s complement binary
11 signed magnitude binary

F - filter function - a value of (0) will result in no filtering, up to a value of (99BCD)


S - real time sampling mode - (0) samples always, (11111binary) gives long delays.

• After the input card reads the values, the results are returned in a block. The structure of the
block is shown below.
page 511

N7:10 0 D D D

1 u16 u15 u14 u13 u12 u11 u10 u9 u8 u7 u6 u5 u4 u3 u2 u1

2 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1

3 s16 s15 s14 s13 s12 s11 s10 s9 s8 s7 s6 s5 s4 s3 s2 s1

4 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1

19 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16 d16

D - diagnostics
u - under range for input channels
v - over range for input channels
d - data values read from inputs
s - sign of data

29.2 ANALOG OUTPUTS

• After we have used a controller equation to estimate a value to put into our process, we must
convert this from a digital value in the computers memory, to a physical voltage.

• This voltage is typically limited to 20mA in most computer boards, and drawing near this cur-
rent reduces accuracy and life of the board.

• A simple circuit is shown below for a simple digital to analog converter.


page 512

5KΩ

10KΩ V– V ss
MSB bit 3 -

V +
20KΩ + +
bit 2
0
Computer Vo
40KΩ
bit 1
-

80KΩ
LSB bit 0

First we write the obvious,


V + = 0 = V–

Next, sum the currents into the inverting input as a function of the output voltage and the
input voltages from the computer,
Vb3 V b2 Vb1 V b0 Vo
--------------
- + --------------
- + --------------
- + --------------
- = -----------
-
10KΩ 20KΩ 40KΩ 80KΩ 5KΩ
∴V o = 0.5V b3 + 0.25V b2 + 0.125V b1 + 0.0625Vb 0

Consider an example where the binary output is 1110, with 5V for on,
∴V o = 0.5 ( 5V ) + 0.25 ( 5V ) + 0.125 ( 5V ) + 0.625 ( 0V ) = 4.375V

• The calculations for the A/D converter resolution and accuracy still apply.

• Consider the example below,


page 513

We need to select a digital to analog converter for an application. The output will vary
from -5V to 10V DC, and we need to be able to specify the voltage to within 50mV.
What resolution will be required? How many bits will this D/A converter need?
What will the accuracy be?

29.2.1 Analog Outputs With A PLC

• An example of an output card is 1771-OFE.

• To output a value we only need to write a single value to the output card
page 514

BT10:1/EN Advance Block Transfer Write


Module Type Generic Block Transfer
Rack 000
Group 3
Module 0
Control Block BT10:1
Data File N9:0
Length 5
Continuous No

• The format for the block that is to be written to the card is shown below.

0 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1 d1

1 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2 d2

2 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3 d3

3 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4 d4

4 F s s s s s s s s p p p p

The following values are for scaling the values.

d - data values for channels 1, 2, 3, or 4


F - data formats (1) binary, (0) BCD
s - scaling factors
p - data signs for the four input channels

29.3 DESIGN CASES

29.3.1 Oven Temperature Control

• Design an analog controller that will read an oven temperature, and when it passes 1200 degrees
the oven will be turned off. The voltage from the thermocouple is passed through a signal con-
page 515

ditioner that gives 1V at 500F and 3V at 1500F. The controller should have a start button and
E-stop.

29.3.2 Statistical Process Control (SPC)

• We can do SPC checking using analog inputs, and built in statistics functions.

• Recall the basic equations for a control chart.

X = ∑ Xj UCL = X + 3σ
X
j=1
LCL = X – 3σ
X

• The general flow would be,


1. Read sampled inputs.
2. Randomly select values and calculate the average and store in memory. Calculate the
standard deviation of the stored values.
3. Compare the inputs to the standard deviation. If it is larger than 3 deviations from the
mean, halt the process.
4. If it is larger than 2 then increase a counter A, or if it is larger than 1 increase a second
counter B. If it is less than 1 reset the counters.
5. If counter A is =3 or B is =5 then shut down.
6. Goto 1.

29.4 PRACTICE PROBLEMS

1. Write a program that will input an analog voltage, do the calculation below, and output an ana-
log voltage.

V out = ln ( V in )
page 516

2. The following calculation will be made when input ‘A’ is true. If the result ‘x’ is between 1 and
10 then the output ‘B’ will be turned on. The value of ‘x’ will be output as an analog voltage. Cre-
ate a ladder logic program to perform these tasks.

A = I:000/00
y
x = 5 1 + sin y B = O:001/00
x = F8:0
y = F8:1
page 517

ans.
SIN
A Source A F8:1
Dest. F8:0

ADD
Source A 1
Source B F8:0
Dest. F8:0

SQR
Source A F8:0
Dest. F8:0

XPY
Source A 5
Source B F8:1
Dest. F8:2

MUL
Source A F8:0
Source B F8:2
Dest. F8:0
LIM
lower lim. 1 B
value F8:0
upper lim. 10

A MOV
Source A F8:0
Dest. N7:0

BT9:0/EN BTW
A Rack 0
Group 0
Module 0
Control Block BT9:0
Data N7:0
Length 13
Continuous No

3. You are developing a controller for a game that measures hand strength. To do this a ‘START’
button is pushed, 3 seconds later a ‘LIGHT’ is turned on for one second to let the user know when
to start squeezing. The analog value is read at 0.3s after the light is on. The value is converted to a
force ‘F’ with the equation below. The force is displayed by converting it to BCD and writing it to
page 518

an output card (O:001). If the value exceeds 100 then a ‘BIG_LIGHT’ and ‘SIREN’ are turned on
for 5sec. Use a structured design technique to develop ladder logic.

V in
F = ------
-
6
page 519

ans.
FS S1 START S2 F>100 S3
waiting sampling winner

TON(S2, 1sec)
TON(S3, 5sec)

FS TON
L ST1
T4:1
preset 1s
U ST2
T4:0/DN BTR
U ST3 Device Analog Input
location 000
BTW Control BT10:1
Device Analog Input Data N9:40
location 000 Length 20
Control BT10:0 BT10:1/DN
DIV
Data N9:0 Source A N9:40
Length 37 Source B 6
T4:1/DN
Dest. N7:0
T4:1/DN
ST2 U ST2
LIGHT
ST3 L ST1
BIG_LIGHT

SIREN TOD
Source A N7:0
ST1
MCR Dest. O:001
START T4:1/DN GRT
U ST1 U ST1
Source A N7:0
Source B 100
L ST2 L ST3
MCR
MOV ST3
Source 0.0 MCR
Dest F8:0
TON
MCR T4:2
preset 5s
ST2
MCR T4:2/DN
U ST3
TON
T4:0 L ST1
preset 0.3s
MCR
page 520

4. Analog inputs require:


a) A Digital to Analog conversion at the PLC input interface module
b) Analog to Digital conversion at the PLC input interface module
c) No conversion is required
d) None of the above

5. You need to read an analog voltage that has a range of -10V to 10V to a precision of 0.1V.
What resolution of A/D converter is needed?

6.
page 521

30. CONTINUOUS CONTROL

• A controlled system includes,


- a basic system that does not achieve objectives by normal means - for our purposes a
mathematical model a such a system is very important.
- some objective for the operation of the system.
- a controller that is matched to system, and tuned to meet the control objective.

• Objectives for control systems might include,


- fast response
- stability
- energy efficiency
- etc.

• The systems below are often directed by control systems.

valve
q1

valve
q2 h

motor
speed, acceleration controller Vin

• Some Notes:
- Neither of these systems have controls.
- They both have inputs, and outputs.
- The output is not always something exiting the system. eg. the water tank height
is the system state.
- We can treat these systems with ‘black boxes’ with lumped parameters.

• All of the inputs and outputs are expressed as physical quantities (as will be seen later).
page 522

30.1 CONTROLLING CONTINUOUS SYSTEMS

• We can use some type of feedback from the system to change the system input (this is called the
control variable).

e.g.
We have the tank of water from before, and we want to control the height of
the water in the tank by adjusting the flow in. To keep the system linear, we
will assume the output flow rate is fixed.

For control add,


feedback 1. Some means of measuring the water height (system state)
setpoint 2. Some input for desired control height
system error 3. Some error compensation
4. An actuator to change the system input

q1
Main water
supply

q2

1. Feedback of hydrostatic pressure through a rubber tube.


2. This input slider adjusts the position of the bellows (can
be adjusted with a screwdriver).
3. Bellows expand/contract as pressure increases/decreases,
and move the rod that closes/opens the valve
4. The valve changes the flow into the tank, thus changing
the water height.
page 523

30.2 CONTROLLING DISCRETE SYSTEMS

• In some cases we will be able to monitor continuous process variables, but only be able to
change discrete actuators. This is common in heating systems, the system is either on/off, but
temperature is monitored continuously.

• A common method is to use two setpoints with upper and lower bounds.

• Consider the example of a heating system in a room.

room
upper temp. overshoot
temp.
limit
set temp.
(nominal)
lower
temp.
limit

time

heater on heater off heater on heater off heater on

Note: This system turns on/off continuously. This behavior is known hunting. If the limits
are set too close to the nominal value, the system will hunt at a faster rate. Therefore, to
prevent wear and improve efficiency we normally try to set the limits as far away from
nominal as possible.

30.3 CONTROL SYSTEMS

• Control systems use some output state of a system and a desired state to make control decisions.

• In general we use negative feedback systems because,


- they typically become more stable
- they become less sensitive to variation in component values
- it makes systems more immune to noise
page 524

• Consider the system below, and how it is enhanced by the addition of a control system.

Control variable

INPUT OUTPUT
(e.g. θgas) SYSTEM
(e.g. velocity)
(e.g. a car)

vdesired verror Driver or θgas vactual


car
+ cruise control
_

The control system is in the box and could be a driver or a cruise control
(this type is known as a feedback control system)

Human rules to control car (also like expert system/fuzzy logic):

1. If verror is not zero, and has been positive/negative for a while, increase/decrease θgas
2. If verror is very big/small increase/decrease θgas
3. If verror is near zero, keep θgas the same
4. If verror suddenly becomes bigger/smaller, then increase/decrease θgas.
5. etc.

• Some of the things we do naturally (like the rules above) can be done with mathematics
page 525

30.3.1 PID Control Systems

• The basic equation for a PID controller is shown below. This function will try to compensate for
error in a controlled system (the difference between desired and actual output values).

u = K c e + K i ∫ edt + K d  ------
de
 dt 

• The figure below shows a basic PID controller in block diagram form.

proportional PID Controller

Kp ( e )
V V
+ +V
integral
+ e u
Ki ( ∫ e ) amp motor
+
- derivative + -V
K d  ----- e
d
 dt 
page 526

e.g.

dv error
θ gas = K c v error + K i ∫ v error dt + K d  ----------------
 dt 

Rule 4
Rules 2 & 3
(Immediate error)
(general difference)
Rule 1
(Long term error)

Kc
Ki Relative weights of components
Kd

This is a PID Controller

Proportional
Integral
Derivative

For a PI Controller
θ gas = K c v error + K i ∫ v error dt

For a P Controller
θ gas = K c v error

For a PD Controller
dv error
θ gas = K c v error + K d  ----------------
 dt 

• The PID controller is the most common controller on the market.

30.3.1.1 - PID Control With a PLC

• The PID calculation is effectively a calculation in the PLC. One basic method of PID control is
i) read voltage, ii) do PID calculation, iii) set output voltage. (Note: it is also common to get a
self contained PID card for the PLC that deals with all inputs and outputs). The ladder logic
below shows a PID control function.
page 527

PID
Control Block: PD12:0
Proc Variable: N7:0
Tieback: N7:1
Control Output: N7:2

This calculation uses the feedback variable stored in ‘Proc Location’ (as read from
the analog input). The result is stored in N7:2 (to be an analog output). The con-
trol block needs to be created and values put in to configure the PID instruction

Note: When entering the ladder logic program into the computer you will
be able to enter the PID parameters on a popup screen.

30.4 DESIGN CASES

30.4.1 Temperature Controller

• Design a controller that will heat an oven to 1200F +/- 30F for 3 hours after a start button is hit.
The temperature is available as an analog voltage that is 1V at 500F and 3V at 1500F. Normal
items such as E-stops should be added.

30.5 PRACTICE PROBLEMS

1. Can PID control solve problems of inaccuracy in a machine?


page 528

31. PLC DATA COMMUNICATION

• We need to be able to connect computers to transfer information.

31.1 COMPUTER COMMUNICATIONS CATEGORIES

• Basic Categories
• Interface to Sensors and Actuators
- Uses readings from sensors to control devices in the environment
- very simple protocols, but often requires specialized hardware and software.
• Interface to computers
- uses machine to machine connection for direct communication
- can appear to be like a local area network
- low speeds (eg. 300 baud, 1.2, 2.4 9.2 Kbaud)
• Local Area Computer Networks
- measured in distances from meters to kilometers
- speed measured in Megabits/sec
- medium includes, wire, fibre-optics, radio frequency
- commonly available in all forms
- inexpensive
• Wide Area Computer Networks
- from city wide, to global
- speed measured in Kilobytes/second
- medium includes, wire, fibre optics, satellite, microwave
- access is costly (some mix of initial and variable costs), and geared to large cor-
porations, or special applications.

• Classification of Interconnected processors (by Physical Size)

Table 1:

Inter-processor Dis- Processors Located in Example


tance Same
0.1 m Circuit Board Data flow machine
1m System Multi-
processor
10 m Room Local
network
100 m Building
1 km Campus
page 529

Table 1:

Inter-processor Dis- Processors Located in Example


tance Same
10 km City Long haul network
100 km Country
1000 km Continent Inter-
connection of long haul
10000 km Planet networks

31.2 THE HISTORY

• Late 50’s
- Bell introduces data communication networks
- Texaco uses remote monitoring and control for automating polymerization plant.
• Early 60’s
- World wide use of data phone system to link airports for maintenance
- Many uses of terminals for inputting and displaying data.
• Mid 60’s
- Uses of computer for large scale test monitoring
- NC part programming being done remotely on time sharing mainframes.
• 70’s
- Advent of Mini computers made it possible for companies to have multiple com-
puters which had to communicate.
• 80’s
- Microprocessor drops cost of computers dramatically, and automated machines
become very common
- Personal computers, and automated machinery start a trend to network small
computers networked with large computers
-

31.3 WITH PLCs

• Interfacing describes a broad group of methods that allow us to pass data between computers
and other devices.

• To connect PLCs for communication, we first need connecting wires. This is the followed by a
communication protocol.
page 530

RS-232/ethernet/devicenet
Computer

Process
PLC
Sensors

normal
connections
Process process
Actuators

• There are a few common methods of interfacing,


serial - a single point to point connection allows data communication over a small number
of wires (eg. RS-232)
parallel - multiple wires are used for data communication. This is only common for older
data bus designs such as printer parallel port and GPIB buses.
network - networks allow multiple connections to pass data. These actually are built upon
the basics of serial and parallel communications

31.4 SERIAL COMMUNICATIONS

• Serial communication channels send data one bit at a time.

• These techniques are often slower, but are essential when transmitting using radio waves, tele-
phone lines, or similar media.

• Serial lines have become one of the most common methods for transmitting data to instruments,
and most personal computers now have two serial ports.

• Serial data can be transmitted two ways,


synchronous - all of the data bits are timed between sender and receiver.
asynchronous - the data bits arrive unannounced, without any coordination between
sender and receiver. (this is the most common)
RS-232/RS-232C - the most common standard using voltage levels
RS-422a/423a/449 - a current loop standard well suited to noisy conditions
RS-485 - allows multiple talkers and listeners on one serial line (this can be the
basis for a network)
page 531

• A typical data byte looks like the one below. The voltage/current on the line is turned on/off. The
width of the bits determines the possible bits per second (bps). The value shown before is used
to transmit a single byte.

on

off

before start data parity stop after

• The bits shown correspond to,


before - this is a period where no bit is being sent and the line is high
start - a single bit to help get the systems synchronized
data - this byte could be 7 or 8 bits, but is almost always 8 now. The value shown here is
01001000 binary.
parity - this lets us check to see if the byte was sent properly. The most common choices
here are no parity bit (just drop it out), or even parity, or odd parity. In this case
there are two bits set. If we are using even parity the bit would be set. If we are
using odd parity the bit would be off
stop - the stop bits allow form a natural pause at the end of the data.
after - a period of time where the line is high before the next byte.

• Typical electrical connections look like,


page 532

50 ft

RS-232c
Txd Rxd
Txd
Rxd
com

3000 ft

RS-422a

Txd
Rxd

3000 ft

RS-423a

Txd
Rxd

31.4.1 RS-232

• This standard is based on a high being +3 to +15V, and an off being -3 to -15V (+/-12V is com-
monly used).

• The typical connection scheme is shown below. notice that the lines are crossed between con-
nectors. Also note that in some cases the dsr/dtr lines are not used. (Note: these are the lines
used when connecting to a modem)
page 533

Computer Modem
com com
txd txd
rxd rxd
dsr dsr
dtr dtr

Computer Computer
A com com B
txd txd
rxd rxd
cts cts
rts rts

• The line names are,


TXD/RXD - (transmit data, receive data) these lines pass data one way from sender to
receiver.
DSR/DTR - (data set ready, data terminal ready) these handshaking lines indicate when
the remote machine is ready to receive data.
COM - a common ground to keep things from blowing up, etc.

• A cable that emulates a modem connection between two devices is shown below and is called a
null modem cable.
page 534

Computer Computer
A com com B
txd txd
rxd rxd
rts rts
cts cts
dsd
dtr
dcd
dsd
dtr dcd

• There are typically two connectors used for these devices. (Note: the connectors have very fine
numbers on them)

1 2 3 4 5 6 7 8 9 10 11 12 13
DB-25
14 15 16 17 18 19 20 21 22 23 24 25

1 2 3 4 5
6 7 8 9 DB-9

• The main pin assignments for the DB-25 are,


Commonly used pins
1 - GND (chassis ground)
2 - TXD (transmit data)
3 - RXD (receive data)
4 - RTS (request to send)
5 - CTS (clear to send)
6 - DSR (data set ready)
7 - COM (common)
page 535

8 - DCD ()
20 - DTR (data terminal ready)
Other pins
9 - Positive Voltage
10 - Negative Voltage
11 - not used
12 - Secondary Received Line Signal Detector
13 - Secondary Clear to Send
14 - Secondary Transmitted Data
15 - Transmission Signal Element Timing (DCE)
16 - Secondary Received Data
17 - Receiver Signal Element Timing (DCE)
18 - not used
19 - Secondary Request to Send
21 - Signal Quality Detector
22 - Ring Indicator (RI)
23 - Data Signal Rate Selector (DTE/DCE)
24 - Transmit Signal Element Timing (DTE)
25 - Busy

• The pin assignments for the DB-9 are,


1 - DCD
2 - RXD
3 - TXD
4 - DTR
5 - COM
6 - DSR
7 - RTS
8 - CTS
9 - RI

• There are other settings such as half/full duplex.

• When communicating between two devices the setting must agree baud rate, stop bits, parity,
data bits, full/half duplex, etc.

• The figure below shows a PLC connected to a data terminal with a serial line. This is followed
by ladder logic to use the serial connection.
page 536

e.g. Connect a dumb terminal to a PLC so that messages can be printed out.

1. Electrical Connections

Wire
PLC
RS232C Card Terminal

MSG

Control Block N7:10

At this location in memory, we will set up some data


to describe the operation
i.e. Read/Write Write
Data Table N7:50
Size 3
Local/Remote Local
setup data stored Remote Station N/A
at N7:10 Link ID N/A
Remote Link type N/A
Local Node Addr. 20
Processor Type ASCII
Dest. Addr. N/A

Data Stored in memory N7:50 65


N7:51 66
N7:52 67

--- This will result in ABC being printed on the terminal


page 537

This can also be done with an AWT (Analog WriTe) command

AWT
Channel 0
String Location ST9:0
Length 3

ST9:0 = ABC

--- This will result in ABC being printed on the terminal

31.4.1.1 - ASCII Functions

• ASCII functions can be used to interpret and manipulate strings in PLCs.

• These functions include,


ABL(channel, control, )- reports the number of ASCII characters including line endings
ACB(channel, control, ) - reports the numbers of ASCII characters in buffer
ACI(string, dest) - convert ASCII string to integer
ACN(string, string,dest) - concatenate strings
AEX(string, start, length, dest) - this will cut a segment of a string out of a larger string
AIC(integer, string) - convert an integer to a string
AHL(channel, mask, mask, control) - does data handshaking
ARD(channel, dest, control, length) - will get characters from the ASCII buffer
ARL(channel, dest, control, length) - will get characters from an ASCII buffer
ASC(string, start, string, result) - this will look for one string inside another
AWT(channel, string, control, length) - will write characters to an ASCII output

• An example of this function is given below,


page 538

• Try the problem below,

Add the following numbers and store the results in ST10:2


ST10:0 “100”
ST10:1 “10”
ST10:2

31.4.2 ASCII (American Standard Code for Information Interchange)

• While numbers are well suited binary, characters don’t naturally correspond to numbers. To
overcome this a standard set of characters and controls were assigned to numbers. As a result,
the letter ‘A’ is readily recognized by most computers world-wide when they see the number
65.
page 539

hexadecimal

hexadecimal
decimal

decimal
ASCII

ASCII
binary

binary
0 0 00000000 NUL 32 20 00100000 space
1 1 00000001 SOH 33 21 00100001 !
2 2 00000010 STX 34 22 00100010 “
3 3 00000011 ETX 35 23 00100011 #
4 4 00000100 EOT 36 24 00100100 $
5 5 00000101 ENQ 37 25 00100101 %
6 6 00000110 ACK 38 26 00100110 &
7 7 00000111 BEL 39 27 00100111 ‘
8 8 00001000 BS 40 28 00101000 (
9 9 00001001 HT 41 29 00101001 )
10 A 00001010 LF 42 2A 00101010 *
11 B 00001011 VT 43 2B 00101011 +
12 C 00001100 FF 44 2C 00101100 ,
13 D 00001101 CR 45 2D 00101101 -
14 E 00001110 S0 46 2E 00101110 .
15 F 00001111 S1 47 2F 00101111 /
16 10 00010000 DLE 48 30 00110000 0
17 11 00010001 DC1 49 31 00110001 1
18 12 00010010 DC2 50 32 00110010 2
19 13 00010011 DC3 51 33 00110011 3
20 14 00010100 DC4 52 34 00110100 4
21 15 00010101 NAK 53 35 00110101 5
22 16 00010110 SYN 54 36 00110110 6
23 17 00010111 ETB 55 37 00110111 7
24 18 00011000 CAN 56 38 00111000 8
25 19 00011001 EM 57 39 00111001 9
26 1A 00011010 SUB 58 3A 00111010 :
27 1B 00011011 ESC 59 3B 00111011 ;
28 1C 00011100 FS 60 3C 00111100 <
29 1D 00011101 GS 61 3D 00111101 =
30 1E 00011110 RS 62 3E 00111110 >
31 1F 00011111 US 63 3F 00111111 ?
page 540

hexadecimal

hexadecimal
decimal

decimal
ASCII

ASCII
binary

binary
64 40 01000000 @ 96 60 01100000 ‘
65 41 01000001 A 97 61 01100001 a
66 42 01000010 B 98 62 01100010 b
67 43 01000011 C 99 63 01100011 c
68 44 01000100 D 100 64 01100100 d
69 45 01000101 E 101 65 01100101 e
70 46 01000110 F 102 66 01100110 f
71 47 01000111 G 103 67 01100111 g
72 48 01001000 H 104 68 01101000 h
73 49 01001001 I 105 69 01101001 i
74 4A 01001010 J 106 6A 01101010 j
75 4B 01001011 K 107 6B 01101011 k
76 4C 01001100 L 108 6C 01101100 l
77 4D 01001101 M 109 6D 01101101 m
78 4E 01001110 N 110 6E 01101110 n
79 4F 01001111 O 111 6F 01101111 o
80 50 01010000 P 112 70 01110000 p
81 51 01010001 Q 113 71 01110001 q
82 52 01010010 R 114 72 01110010 r
83 53 01010011 S 115 73 01110011 s
84 54 01010100 T 116 74 01110100 t
85 55 01010101 U 117 75 01110101 u
86 56 01010110 V 118 76 01110110 v
87 57 01010111 W 119 77 01110111 w
88 58 01011000 X 120 78 01111000 x
89 59 01011001 Y 121 79 01111001 y
90 5A 01011010 Z 122 7A 01111010 z
91 5B 01011011 [ 123 7B 01111011 {
92 5C 01011100 yen 124 7C 01111100 |
93 5D 01011101 ] 125 7D 01111101 }
94 5E 01011110 ^ 126 7E 01111110 r arr.
95 5F 01011111 _ 127 7F 01111111 l arr.
page 541

e.g. The sequence of numbers below will convert to

65

A W E E T E S T

31.5 PARALLEL

• This I/O port uses multiple data lines (one for each bit) and extra lines for handshaking.

• These cables can permit very high data transfer rates.

• Because of the extra conductors the cables are large, most costly, length limited and much less
flexible

31.6 NETWORKS

• A Network is a way of connecting different computers to allow data and message passing, and
resource sharing.

• Early communication techniques included telegraphs (with morris code), telephones and tele-
types.

• Advantages
- allows shared computers and peripherals
- provides communication and cooperation tools for people and computers
- increases reliability by having alternate computers available
- decreases isolation of many computers

• Disadvantages
- more sophisticated hardware and knowledge required
- additional costs

• Applications,
- allows remote access to databases and libraries
- electronic mail
page 542

- distributed computational facilities


- remote control of applications

31.6.1 Introduction

• The relationship between various network types is shown below

Example LAN Topologies

Bus or Ring Star

...

- Shared Media
- Distributed Control
- No media sharing
- Central Control
page 543

• The Star Network topology uses many connections to a central server


- Central control

- Dedicated communication channels

- Single point of failure

- Often compatible with telephone


wiring (voice/data integration)

- Typical minicomputer and mainframe


environments

• When all computers are connected to the same network cable, there are a number of structures
which may be used. The bus topology below is simpler, and the tree topology is more flexible
page 544

and versatile. This approach uses a single cable which is easy to add to

...
Bus Topology

...
Tree Topology

R Repeater

• The ring topology below shows a closed loop of cable which can be simple to implement, but
page 545

limited in capabilities

- Distributed control

- Entire communication capacity


capacity for any station

- Vulnerable to loss of shared


communication facilities

- Primary vendors: IBM & Proteon

• An enhanced ring topology is pictured below

Characteristics
HOST
N o. 3 H O ST
- Control token passed from
N o. 2
node to node

- Only node with token can transmit

- Token replaced on ring at the end


start of
S message
of message
HO ST
- Permits variable size messages N o. 4
HOST
- Only one message on the ring E N o. 1
at a time
end of
message
direction of message flow

• Significant issues in networks are,


page 546

Network power - does the network distribute power, or does each station need to be sepa-
rately powered.
Network tees - to tap into the network cable simple connections can be used, or the con-
nection can have circuitry.
Transmission type - switched voltage levels (baseband), single band FSK (carrierband),
multiple frequency FSK (broadband). The FSK methods allow much higher net-
work speeds.
Bus access - When network nodes share the same wire they may try to talk at the same
time (this is called a network collision). Different schemes for dealing with colli-
sions include,
CSMA/CD (Collision Sense Multiple Access/Collision Detection) - if two nodes
start talking and detect a collision then they will stop, wait a random time, and
then start again.
CSMA/BA (Collision Sense Multiple Access/Bitwise Arbitration) - if two nodes
start talking at the same time the will stop and use their node addresses to deter-
mine which one goes first.
Master-Slave - one device one the network is the master and is the only one that
may start communication. slave devices will only respond to requests from the
master.
Token Passing - A token, or permission to talk, is passed sequentially around a net-
work so that only one station may talk at a time.

31.6.2 OSI Network Model

• Advantages
- Computers not necessarily from the same manufacturer
- Allow computers to communicate information.
- Sharing of equipment such as printers, disks, etc.
- Programs can run on multiple machines improving performance
- Access to machines with better/different resources.

• General OSI Diagram contains seven layers


page 547

Layer Layer Name Unit of Transmission

7 Application Message Application

6 Presentation Message Presentation

5 Session Message Session

4 Transport Message Transport

3 Network Packet Network

2 Data Link Frame Data Link

Layer Protocol
1 Physical Bit Physical

Interconnecting Medium
A Layer Interface

31.6.2.1 - Physical Layer

• Physical layer is concerned with transmission of raw bits over a physical circuit.

• Deals with voltages, timing, connections, etc.

• Responsible for bit synchronization and the identification of a signal element as either a 0 or a 1.

• Protocols: RS-232, RS-449, CCITT X.25 and X.21, IEEE 802


page 548

31.6.2.2 - Data Link Layer

• Data link layer breaks input data into “data frames” and processes acknowledgments.

• Object is to provide a error-free transmission line to the network layer.

• Responsible for the reliable delivery of information over a point-to-point or multipoint link.

• Supervises interchange of both link control data and user information

• Protocols: ANSI X3.28, HDLC, X.25, ISDN, IEEE 802

31.6.2.3 - Network Layer

• Network layer determines the interface between the computer and the intermediate system, how
packets are routed.

• Chooses a route from the available data links that form the network.

• Object is to take messages, convert them to packets and send them towards the destination.

• Protocols: CCITT X.25, X.21, IP, CCITT Q.931, ISO 8473

31.6.2.4 - Transport Layer

• Transport layer takes data from the session layer, splits it up if necessary, and passes this to the
network layer.

• Ensures that pieces all arrive correctly at the other end.

• Isolates the user from any concern for the actual movement of the information.

• Protocols: TCP, ISO 8073

31.6.2.5 - Session Layer

• Session layer defines a connection between users (presentation layer processes).


page 549

• Includes specification of the remote machine, authorization, options for the communication, and
recovering from errors in broken transport connections.

• The set-up of communications is called binding.

• Protocols: ISO 8327, CCITT X.225, T.62, ECMA 75, NFS, RPC.

31.6.2.6 - Presentation Layer

• Ensures compatible syntax among the communicating processes by adjusting data structures,
formats, and codes.

• Presentation layer is generally represented by library routines which the user accesses to per-
form network operations.

• This layer can also perform transformations such as compression and encryption.

• Protocols: DIS 8823, 8824, 8825, CCITT X.409, T.61

31.6.2.7 - Application Layer

• Application layer is written by the user, or is a program that performs some function for the user.

• Provides a window by which the user gains access to the communication services provided by
the architecture.

• Protocols: DIS 8571, 8832, 9040

31.6.2.8 - Open Systems


page 550

Control
Services Primitives
(N+1) th Layer

N th Layer

System/Vendor X System/Vendor Y
Functional Peer Protocol Functional
Entity Entity

(N-1) th Layer
Control Services
Primitives

• Open Systems Principles


• Entity is a group of functions for a particular task. Accept input, and produce output.
• Layer is a group of functions designed to provide a set of services related to the mission
of that layer
• Entities provide a set of services to the layer above. In doing this they use the services of
the underlying layers.
• Each layer isolates the layer above from the details of the underlying layers, and thus a
lower layers characteristics can change without affecting the rest of the system.
• Primitives control the layer’s services and data flow. Primitives fall into 4 groups:
Request, Indicate, Response, and Confirm

• We can do a simple comparison of networking models


page 551

ISO/OSI Internet SNA DECNET

Application User Application


Application
Presentation Telnet, Ftp NAU services

Data flow control


Session (None) (None)
Transmission control
Host-Host
Transport Network services
Source to destination IMP
Path Control
Network Transport

IMP-IMP
Data Link Data link control Data link control

Physical Physical Physical Physical

31.6.2.9 - Networking Hardware

• A number of basic components are required for networks

• Computer (or dedicated computing equipment)


- An obvious must. Without the computer there is no need for networking
- Approximate cost $500 to $1,000,000

• Network Interface Hardware


- Some computers come with built in network interfaces, If these are for the wrong net-
work types, or there is no network interface, a networking interface must be pur-
chased.
- examples are ethernet, latticenet, fibre, etc.
- Approximate Cost $30.00 and up

• The Media,
- This is the cabling which will connect the computers
page 552

- 10base2 (thin wire) is thin shielded coaxial cable with BNC connectors
- 10baseF (fiber optic) is costly, but signal transmission and noise properties are very
good.
- 10baseT (twisted pair) is the most popular. It is a pair of twisted copper wires terminated
with an RJ-45 connector.
- Approximate cost for thick net $40 + $5/station, for thin net $10 + $1/station
- 10base2

• Transceiver
- A device which is sometimes included between the network media, and the network
interface hardware.
- Allows easy changes to media type.
- Not used for thin cable computer interfaces.
- Approximate costs $100 to $200

• Hub/Concentrator
- Connects separate wires and will route local traffic to local wires and remote through
external connections.
- approximate cost $50/wire

• Bridges, (Data link layer)


- Used when hooking one network type to another, or isolating one part of a network from
another.
- A bridge can be used for hooking an ethernet cable to an optical backbone cable.
- Has one input, one output, and will only handle sorting by network address (like ethernet
address of machine).
- Approximate cost $2,000 to $5,000
- Same functionality as router.

• Routers, (Network Layer)


- When there are too many networks on the same network, a router can be used to isolate
small loops of the network from traffic which does not involve it.
- More intelligent than a bridge, multiple inputs/outputs.
- Sorts Network packets by IP address.
- Approximate cost $5,000 to $10,000.

• Repeaters, (Physical Layer)


- If network cables are too long, the repeaters will boost the signal strength so that it may
complete it’s journey.
- Also allows media to be changed

• Networking Software / Networking Management Software


- Handles networking interface control for,
- receiving / sending data or files
- electronic mail tools
- messaging systems
page 553

- etc
- Examples of this are NFS (Network File Server), SNMP (Simple Network Management
Protocol)
- Approximate costs >$1,000, unless provided with system

• Gateways (Application, Presentation, Session and Transport layers)

• An example of a micro computer with a networked interface

Network
Tap

RAM

IO-system PROM

80586 CPU

LAN
Token Bus Handler
Cable
(Dual Gate Array)

• Basic network hardware can be described with the 7-layer ISO model,
page 554

7 - application

6 - presentation gateway

5 - session

4 - transport

3 - network

2 - data link
router
1 - physical bridge

31.7 BUS TYPES

• Low level busses,


- RS-485
- Bitbus
- CAN bus
- Lonworks
- Arcnet

• General open buses,


- ASI
- Devicenet
- Interbus-S
- Profibus
- Smart Distributed System (SDS)
- Seriplex

• Specialty buses,
- Genius I/O
- Sensoplex
page 555

31.7.1 Devicenet

• Devicenet is meant as a noise resistant, robust, shop floor network.

• The main change that the user will notice is that a rack of a PLC can be broken up and CPU, I/O,
etc. are now connected by Devicenet.

• Devicenet is an open standard, so components can come from a variety of suppliers.

• Based on the CANbus (Controller Area Network) protocol.

• Some advantages,
- open system is not tied to a single vendor
- diagnosis of devices is possible
- wiring becomes easier (no long wire runs)
- complex devices are easy to connect
- possibility of using a PC based control package
- multiple controllers can share the net

• Basic features
- up to 64 nodes on the network
- lengths of 500m/250m/100m for speeds of 125kbps/250kbps/500kbps respectively
- data packet size of 0-8 bytes
- power and signal in the same cable
- single bus cable
- addressing includes peer-to-peer, multicast, master/slave, polling or change of state
- devices can be added/removed while power is on

• Devicenet is a layer 7 - application protocol (Note that CANbus is level 2)

• A typical structure for Devicenet is shown below,


page 556

thin thin
trunk tap trunk thick trunk line
power tap
line line
terminator

terminator
drop
line flexIO
rack PC
tap
drop
line

smart flexIO power


sensor rack supply

• There are two types of wire used,


Thick trunk - carries up to 8A for power up to 500m
Thin trunk - up to 3A for power up to 100m

power (24Vdc)

data

drain/shield

• Power supplies are directly connected to the cable to supply power.

• The drop lengths are limited


- total length/speed 156m/78m/39m are 125Kbps/250Kbps/500Kbps respectively
- a single drop is limited to 6m

• The wiring can come in a form of end/connectors,


- bare wires
- unsealed screw connector
- sealed mini connector
- sealed micro connector
- vampire taps
page 557

• Devices may have a red/green status light for the network status.

• Devicenet used the CANbus indentifier to specify,


message types (5 bits)
node number (6 bits) up to 64 nodes on the net

• On a PLC-5 rack you would need a devicenet interface and could use the instructions below.

N7:0/EN MSG N7:0/EN MSG


(EN) (EN)
Send/Rec Message (DN) Send/Rec Message (DN)
Control Block N7:0 Control Block N7:0
(ER) (ER)

Read/Write Write Read/Write Read


Data Table N7:20 Data Table N7:40
Size 20 Size 20
Local/Remote Remote Local/Remote Remote
Remote Station ?? Remote Station ??
Link ID ?? Link ID ??
Remote Link type ?? Remote Link type ??
Local Node Addr. N/A Local Node Addr. N/A
Processor Type ???? Processor Type ????
Dest. Addr. N7:40 Dest. Addr. N7:20

Note:

• On a Softlogix PLC the I/O will be copied into blocks of integer memory. These blocks are
selected by the user in the setup of the software. Here the inputs are copied into N9 integer
memory, and the outputs are set by copying the N10 block of memory back to the outputs.

N9:0
N10:23
page 558

31.7.2 CANbus

• The CANbus (Controller Area Network) uses bit wise resolution for collisions on the network
(i.e., the lower the network identifier, the higher the priority for sending)

• A data frame for the CANbus is shown below,

1 bit start of frame

11 bits identifier
arbitration field
1 bit ready to receive it

6 bits control field - contains number of data bytes

0-8 bytes data - the information to be passed

15 bits CRC sequence

1 bit CRC delimiter

1 bit ACK slot - other listeners turn this on to indicate frame received

1 bit ACK delimiter

7 bits end of frame

>= 3 bits delay before next frame

• Each device listens to the frame it sent to ensure proper communication.

31.7.3 Controlnet

• This is intended for communication between controllers, and permits more complex messages
than Devicenet.
page 559

31.7.4 Profibus

• A control network that is popular overseas, and primarily pushed by Siemens.

• General features include,


- A token passing between up to three masters
- maximum of 126 nodes
- straight bus topology
- length from 9600m/9.6Kbps with 7 repeaters to 500m/12Mbps with 4 repeaters
- 2 data lines and shield
- power needed at each station
- uses RS-485
- 2048 bits of I/O per network frame
-

31.7.5 Ethernet

31.7.6 Proprietary Networks

31.7.6.1 - Data Highway

• Major features of the DH+ network,


- up to 64 nodes
- peer to peer with token passing
- uses shielded twisted pair cables
- data rates of 57.6Kbps, 230 Kbps

• The basic data frame looks like,


page 560

1 byte DLE = $10

1 byte SOH = $01

1 byte STN - the destination number

1 byte DLE
control fields
1 byte STX

data

1 byte DLE

1 byte ETX

1 byte block check - a 2s compliment checksum of the DATA and STN values

• The data packet looks like that shown below (but it will vary depending upon the requested com-
mand).

1 byte DST - destination node for the message

1 byte SRC - the node that sent the message

1 byte CMD - network command - sometime FNC is required

1 byte STS - message send/receive status

2 byte TNS - transaction field (a unique message ID)

optional 1 byte FNC may be required with some CMD values

optional 2 byte ADDR - a memory location

optional variable DATA - a variable length set of data

optional 1 byte SIZE - size of a data field

• Some command examples include,


page 561

CMD FNC Description

Basic $06 $00 Diagnostic loop


$02 Protected bit write
$00 Protected write
$06 $04 Set timeout
$06 $02 Set variable
$01 Unprotected read
$08 Unprotected write

PLC-5 $0F $50 Download all request


$0F $17 Read bytes physical
$0F $53 Upload all request
$0F $01 Word range read
$0F $00 Word range write

• Example for the Allen-Bradley PLC-5 Data Highway Network Connection


page 562

N7:0/EN MSG N7:0/EN MSG


(EN) (EN)
Send/Rec Message (DN) Send/Rec Message (DN)
Control Block N7:0 Control Block N7:0
(ER) (ER)

Read/Write Write Read/Write Read


Data Table N7:20 Data Table N7:40
Size 20 Size 20
Local/Remote Local Local/Remote Local
Remote Station N/A Remote Station N/A
Link ID N/A Link ID N/A
Remote Link type N/A Remote Link type N/A
Local Node Addr. 2 Local Node Addr. 1
Processor Type PLC-5 Processor Type PLC-5
Dest. Addr. N7:40 Dest. Addr. N7:20

Note: This will allow the PLC program on the left to send 20 bytes of data to the PLC
program on the right over a data highway connection. The data block in the source
PLC starts at N7:20 and the destination address starts at N7:40. The local reference
is normally used when dealing with direct connections to other PLCs with DH+.
The node address of the source is 1 and the destination address is 2.

31.7.7 Other Network Types

• PROFIBUS (Professional Field Bus) is an emerging standard for PLC communication that Sie-
mens has incorporated into its product line with the “SINEC L2” bus. Companies such as Festo
have agreed to follow the bus standard.

31.8 DESIGN CASES

31.8.1 PLC Interface To Robots And NC Machines

• Most robots have inputs and outputs that can be connected directly to sensors, actuators, PLCs,
etc.

• Consider a case where a PLC controls a press and a robot unloads it.
page 563

press done/waiting for robot


Robot
PLC

robot done/ press can start

parts stacked on pallet

Parts Pallet

31.9 PRACTICE PROBLEMS

1. Explain why networks are important in manufacturing controls.

ans. These networks allow us to pass data between devices so that individually controlled systems
can be integrated into a more complex manufacturing facility. An example might be a serial con-
nection to a PLC so that SPC data can be collected as product is made, or recipes downloaded as
they are needed.

2. We will use a PLC to control a cereal box filling machine. For single runs the quantities of
cereal types are controlled using timers. There are 6 different timers that control flow, and these
result in different ratios of product. The values for the timer presets will be downloaded from
another PLC using the DH+ network. Write the ladder logic for the PLC.
page 564

ans. Read Message


MG9:0/EN on Remote station #1
MSG Remote Addr. N7:0
MG9:0 Length 6
Destination N7:0
MG9:0/DN on
FAL
DEST. #T4:0.PRE
EXPR. #N7:0

start stop
on

on

box present on
TON
T4:0

TON
T4:1

TON
T4:2

TON
T4:3

TON
T4:4

TON
T4:5
T4:0/TT
fill hearts

T4:1/TT
fill moons

ETC...
page 565

3. a) We are developing ladder logic for an oven to be used in a baking facility. A PLC is control-
ling the temperature of an oven using an analog voltage output. The oven must be started with a
push button and can be stopped at any time with a stop push button. A recipe is used to control the
times at each temperature (this is written into the PLC memory by another PLC). When idle, the
output voltage should be 0V, and during heating the output voltages, in sequence, are 5V, 7.5V,
9V. The timer preset values, in sequence, are in N7:0, N7:1, N7:2. When the oven is on, a value of
1 should be stored in N7:3, and when the oven is off, a value of 0 should be stored in N7:3. Draw
a state diagram and write the ladder logic for this station.

b) We are using a PLC as a master controller in a baking facility. It will update recipes in remote
PLCs using DH+. The master station is #1, the remote stations are #2 and #3. When an operator
pushes one of three buttons, it will change the recipes in two remote PLCs if both of the remote
PLCs are idle. While the remote PLCs are running they will change words in their internal memo-
ries (N7:3=0 means idle and N7:3=1 means active). The new recipe values will be written to the
remote PLCs using DH+. The table below shows the values for each PLC. Write the ladder logic
for the master controller.

button A button B button C

13 17 14
PLC #2 690 235 745
45 75 34

76 72 56
345 234 645
PLC #3 987 12 23
345 34 456
764 456 568
87 67 8

4. Describe what the bits would be when an ‘A’ (ASCII 65) is transmitted in an RS-232 interface
with 8 data bits, even parity and 1 stop bit.

5.
page 566

32. HUMAN MACHINE INTERFACES (HMI)

• These allow control systems to be much more interactive than before.

32.1 INTRODUCTION

• The basic purpose of an HMI is to allow easy graphical interface with a process.

• These devices have been known by a number of names,


- touch screens
- displays
- Man Machine Interface (MMI)
- Human Machine Interface (HMI)

• These allow an operator to use simple displays to determine machine condition and make simple
settings.

• The most common uses are,


- display machine faults
- display machine status
- allow the operator to start and stop cycles
- monitor part counts

• These devices allow certain advantages such as,


- color coding allows for easy identification (eg. red for trouble)
- pictures/icons allow fast recognition
- use of pictures eases problems of illeteracy
- screen can be changed to allow different levels of information and access

• The general implementation steps are,


1. Layout screens on PC based software.
2. Download the screens to the HMI unit.
3. Connect the unit to a PLC.
4. Read and write to the HMI using PLC memory locations to get input and update
screens.

• To control the HMI from a PLC the user inputs set bits in the PLC memory, and other bits in the
PLC memory can be set to turn on/off items on the HMI screen.
page 567

32.2 HMI/MMI DESIGN

• The common trend is to adopt a user interface which often have,


- Icons
- A pointer device (such as a mouse)
- Full color
- Support for multiple windows, which run programs simultaneously
- Popup menus
- Windows can be moved, scaled, moved forward/back, etc.

• The current demands on user interfaces are,


- on-line help
- adaptive dialog/response
- feedback to the user
- ability to interrupt processes
- consistent modules
- a logical display layout
- deal with many processes simultaneously

• To design an HMI interface, the first step is to identify,


1. Who needs what information?
2. How do they expect to see it presented?
3. When does information need to be presented?
4. Do the operators have any special needs?
5. Is sound important?
6. What choices should the operator have?

32.3 DESIGN CASES

• Design an HMI for a press controller. The two will be connected by a Devicenet network.
page 568

Press and PLC


HMI

32.4 PRACTICE PROBLEMS

1.
page 569

33. DESIGNING LARGE SYSTEMS

33.1 PROGRAMMING

• Some concepts to observe,


- break a large program into smaller parts, and separate out operations as much as possible.
Questions to ask are,
= do things need to happen at the same time?
= does a process occur all the time?
- develop lists of the data needed before starting
- find a way to keep programs compact, and more usable.
- plan on paper before starting

• Write programs to have an executive subroutine

• Use flags to pass messages between separated programs

• put each separate program in a separate program file, and give it its own section of memory to
avoid conflicts

• If possible use subroutines to reduce redundancy

• Build with testing in mind

• write comments and documents as you go. It even helps to write documents before implement-
ing - this gives more clarity, and exposes mistakes before they occur.

• Typical problems in large projects include,


- amateur designers rush through design to start work early, but details they missed take
much longer to fix when they are half way implemented.
- details are not planned out and the project becomes one huge complex task instead of
groups of small simple tasks.
- designers write one huge program, instead of smaller programs. This makes proof read-
ing much harder, and not very enjoyable
- programmers sit at the keyboard and debug by trial and error. If a programmer is testing
a program and an error occurs, there are two possible scenarios. First, the program-
mer knows what the problem is, and can fix it immediately. Second, the program-
mer only has a vague idea, and often makes no progress doing trial-and-error
debugging. If trial-and-error programming is going on the program is not under-
stood, and it fixed through planning.
- small details are left to be completed later. These sometimes are left undone, and lead to
failures in operation.
- the design is not frozen, and small refinements and add-ons take significant amounts of
page 570

time, and often lead to major design changes.


- the designers use unprofessional approaches. They tend to follow poor designs, against
the advice of their colleagues. This is often because the design is their ‘child’
- designers get a good dose of the ‘not invented here’ syndrome. Basically, if we didn’t
develop it, it must not be any good.
- limited knowledge will cause problems. The saying goes “If the only tool you know how
to use is a hammer every problem looks like a nail.”
- biting off more than you can chew. some projects are overly ambitious. Avoid adding
wild extras, and just meet the needs of the project. Sometimes an uncessary extra
can take more time than the rest of the project.

33.2 DOCUMENTATION

• These forms are used to prepare ladder logic programs.

• Documentation should be done as a running record of work done and decisions made.

• With industrial control, the traditional approach of trial and error debugging of programs should
not be used. Programs should be developed to work right the first time.
page 571

33.3 PLC PROGRAM DESIGN FORMS

PLC Project Sheet


Project ID:

Start Date:

Contact Person:

PLC Model:

Attached Materials/Revisions:

Date Name # Sheets Reason


page 572

Project Notes
Project ID: Date:
System Description Page of
I/O Notes
Power Notes Name:
Other Notes
page 573

Design Notes
Project ID: Date:

State Diagram Truth Table Page of


Flow Chart Safety
Sequential Function Chart Communications Name:
Boolean Equations Other Notes
page 574

Application Notes
Project ID: Date:

Test Plan Page of


Electrical I/O
PLC Modules Name:
Other Notes
page 575

Input/Output Card Page of

Project I.D. Name Date

Card Type Rack # Slot #


Notes:

input/output JIC symbol Description


Vin

00

01

02

03

04

05

06

07

08/10

09/11

10/12

11/13

12/14

13/15

14/16

15/17

com
page 576

Internal Locations Page of

Project I.D. Name Date

Register or Word
Description
Internal Word
page 577

Program Listing Page of

Project I.D. Name Date

rung# comments
page 578

33.4 PRACTICE PROBLEMS

1. Documentation of a PLC Ladder Logic program requires:


a) A copy of the uncommented Ladder Logic Program
b) A copy of the commented Ladder Logic program
c) A copy of the commented Ladder Logic program and a listing of the
inputs/outputs and their addresses
d) None of the above

(ans. c)

2. TRUE / FALSE -- When planning Ladder Logic, the inputs/outputs should be chosen before
anything else.

(ans. true)

3. List 5 advantages of using structured design and documentation techniques.

ans.
- more reliable programs
- less debugging time
- more routine
- others can pick up where you left off
- reduces confusion
page 579

34. IMPLEMENTATION

34.1 ELECTRICAL

34.1.1 Electrical Wiring Diagrams

• PLC’s are generally used to control the supply of power to a system. As a result, a brief exami-
nation of electrical supply wiring diagrams is worthwhile.

• Generally electrical diagrams contain very basic circuit elements, such as relays, transformers,
motors, fuses, lights, etc.

• Within these systems there is often a mix of AC and DC power, but 3 phase AC power is what is
delivered universally by electric utilities, so the wiring diagrams focus on AC circuits.

• A relay diagram for a simple motor with a seal in circuit might look like the one shown below,
page 580

terminals power interrupter motor starter

M
L1

M
motor
L2
3 phase
M AC
L3

step down transformer

start
stop
M

• The circuit designed for the motor controller must be laid out so that it may be installed in an
insulated cabinet. In the figure below, each box could be a purchased module(s).
page 581

Main Breaker Contactors

Transformer

Start Overload

Stop Terminal Block

A Physical Layout for the control cabinet

• After the Layout for the cabinet is determined, the wire paths must be determined. The figure
below lays out the wire paths, and modules to be used.
page 582

L1

L2

L3

start

stop

motor
3 phase
3 phase AC AC

34.1.1.1 - JIC Wiring Symbols


page 583

• The last section contained an example of an electrical control system for a motor. It used a num-
ber of symbols to represent elements.

• The Joint International Committee (JIC) developed a standard set of symbols for representing
electrical circuit elements. These are given below.

normally open normally closed


proximity switch proximity switch
page 584

disconnect circuit interrupter


(3 phase AC) (3 phase AC)

normally closed
normally open limit switch
limit switch breaker (3 phase AC)

normally open normally closed


push-button push-button double pole mushroom head
push-button push-button
F

thermal
overload relay fuse motor (3 phase AC)

liquid level liquid level vacuum pressure vacuum pressure


normally open normally closed normally open normally closed
page 585

temperature flow
normally open temperature flow normally closed
normally closed normally open

relay contact relay contact relay coil indicator lamp


normally open normally closed

relay time delay on relay time delay off


relay time delay on normally closed relay time delay off normally closed
normally open normally open

H1 H3 H2 H4

horn buzzer bell X1 X2


control transformer
2-H

solenoid 2-position
hydraulic solenoid
page 586

Resistor Tapped Resistor Variable Resistor


(potentiometer)

Rheostat Capacitor Polarized Capacitor


(potentiometer)
+

Capacitor Battery
Variable Capacitor

Crystal Thermocouple Antenna

Shielded Conductor Shielded Grounded

Coil or Inductor
Common Coil with magnetic core

Tapped Coil Transformer


Transformer magnetic core
page 587

Female connector Male connector

34.1.2 Wiring

• Discrete inputs - If a group of input voltages are the same, they can be grouped together. An
example of this is shown below.

PLC Input

+ I0

I1
24VDC
I2

I3
- COM.

• If the input voltages are different and/or come from different sources, the user might use isolated
inputs.

PLC Input Card


24VAC

COM I0
N0
+
I1
24VDC
- N1
I2
+ N2
12VDC
-
page 588

34.1.3 Shielding and Grounding

• There are two problems that occur in these systems,


1. Different power sources in the same system can cause different power supply voltages
at opposite ends of a wire. As a result a current will flow, and an unwanted voltage
appears. This can destroy components and create false signal levels.
2. Magnetic fields crossing the long conductors or in conductor loops can induce currents,
and destroy equipment, give false readings, or add unwanted noise to analog data
signals.

• Typical sources of grounding and shielding problems are,


- electrostatic
- magnetic
- electromagnetic
- resistance coupled circuits
- ground loops

• General shielding design points,


- choose a metal cabinet that will shield the control electronics
- avoid “noisy” equipment when possible
- separate voltage levels, and AC/DC wires from each other when possible.
- use shielded cables and twisted pair wires

• Grounding problems include,


- Resistance coupled devices can have interference through a common power source, such
as power spikes or brownouts caused by other devices in a factory.
- Ground loops are caused when too many separate connections to ground are made creat-
ing loops of wire that become excellent receivers for magnetic interference that
induces differences in voltage between grounds on different machines. The com-
mon solution is to use a common ground bar.
page 589

Preferred

device A device A
ground loop #1

device B device B

ground loop #2

-V
gnd
+V
+V -V

power gnd power


supply supply

- The case of an object should be tied to ground to give current a path to follow in the case
of a fault that energizes the case. (Note: fuses or breakers will cut off the power,
but the fault will be on for long enough to be fatal.)

e.g., wire break off


and touches case

Current can flow two ways, but most will follow the path of least
resistance, good grounding will keep the worker relatively safe
in the case of faults.

• Good grounding rules include,


- each PLC component should be grounded back to the main PLC chassis
- the ground wire should be separated from power wiring in enclosures
- use star washers to ensure good electrical connection
page 590

- mount ground wires on bare metal, remove paint if needed


- use 12AWG stranded copper for PLC equipment grounds and 8AWG stranded copper for
enclosure backplate grounds
- connect the enclosure to the ground bus
- connect the machine ground to the enclosure ground
- the ground connection should have little resistance (<0.1 homs is good)

• Electrocution potential must be observed.


- Safe current levels are listed below. But be aware that in certain circumstances very low
currents can kill, when in doubt, take no chances.

current in body (mA) effect


0-1 negligible (5VDC)
1-5 uncomfortable (24VDC)
10-20 possibility for harm (120VAC)
20-50 muscles contract (220VAC)
50-100 pain, fainting, physical injuries
100-300 heart fibrillates
300+ burns, breathing stops, etc.
- Step potential is another problem. Electron waves from a fault travel out in a radial direc-
tion through the ground. If a worker has two feet on the ground at different radial
distances, there will be a potential difference between the feet that will cause a cur-
rent to flow through the legs. The gist of this is - if there is a fault, don’t run/walk
away/towards.
- Always ground systems first before applying power. (The first time a system is activated
it will have a higher chance of failure.)

• Fail-safe wiring should be used so that if wires are cut or connections fail, the equipment should
turn off. e.g., if a normally closed stop button is used, and the connector is broken off, it will
cause the machine to stop, as if the stop button has been pressed, and brake the connection.
NO (Normally open) - When wiring switches or sensors that start actions, use normally
open switches so that if there is a problem the process will not start.
NC (Normally Closed) - When wiring switches that stop processes use normally closed so
that if they fail the process will stop. E-Stops must always be NC, and they must
cut off the master power, not just be another input to the PLC.

• Other wiring notes,


- always use a master power relay that will shut down the process, and connect it to the E-
stop system.
- use electrical wiring to handle all safety functions
- shutdown buttons must be easily accessible from all points around the machine
page 591

34.2 SAFETY

• Some of the basic rules are,


• a fail-safe design - Programs should be designed so that they check for problems, and
shut down in safe ways. Most PLC’s also have imminent power failure sensors,
use these whenever danger is present to shut down the system safely.
• proper programming techniques and modular programming will help detect possible
problems on paper instead of in operation.
• make the program inaccessible to unauthorized persons
• use predictable, non-configured programs
• use redundancy in hardware
• directly connect emergency stops to the PLC, or the main power supply
• check for system OK at start-up
• provide training for new users and engineers to reduce careless and uninformed mistakes
• use PLC built in functions for error and failure detection
• use well controlled startup procedures that check for problems
• provide clear and current documentation for maintenance and operators
• modular well designed programs

34.2.1 Troubleshooting

• A reasonable troubleshooting guide (note - not debugging),


1. Look at the process and see if it is in a normal state. i.e. no jammed actuators, broken
parts, etc. If there are visible problems, fix them and restart the process.
2. Look at the PLC to see which error lights are on. Each PLC vendor will provide docu-
ments that indicate which problems correspond to the error lights. Common error
lights are given below. If any off the warning lights are on, look for electrical sup-
ply problems to the PLC.
HALT - something has stopped the CPU
RUN - the PLC thinks it is OK (and probably is)
ERROR - a physical problem has occurred with the PLC
3. Check indicator lights on I/O cards, see if they match the system. i.e., look at sensors
that are on/off, and actuators on/off, check to see that the lights on the PLC I/O
cards agree. If any of the light disagree with the physical reality, then interface
electronics/mechanics need inspection.
4. Consult the manuals, or use software if available. If no obvious problems exist the prob-
lem is not simple, and requires a technically skilled approach.
5. If all else fails call the vendor (or the contractor) for help.
page 592

34.2.2 Forcing Outputs

• Don’t do it.

• But if you really have to, remember that the machine can be unsafe while doing this.

• While a program is running in a PLC, you can specifically force inputs or outputs to turn on/off.
This is best use for,
- testing outputs - if you are doing this you will be checking wiring and the output card.
This can be done directly.
- force inputs to determine how the program will respond - if you are doing this you don’t
understand your program, and you should sit down and figure it out.

• Possible bad outcome of forcing outputs,


- damaged or jammed machine components
- injuries to workers

34.2.3 PLC Environment

• Care must be taken to avoid certain environmental factors.


- Dirt - Dust and grime can enter the PLC through air ventilation ducts. As dirt clogs inter-
nal circuitry, and external circuitry, it can effect operation. A storage cabinet such
as Nema 4 or 12 can help protect the PLC.
- Humidity - Humidity is not a problem with many modern materials. But, if the humidity
condenses, the water can cause corrosion, conduct current, etc. Condensation
should be avoided at all costs.
- Temperature - The semiconductor chips in the PLC have operating ranges where they are
operational. As the temperature is moved out of this range, they will not operate
properly, and the PLC will shut down. Ambient heat generated in the PLC will
help keep the PLC operational at lower temperatures (generally to 0°C). The upper
range for the devices is about 60°C, which is generally sufficient for sealed cabi-
nets, but warm temperatures, or other heat sources (e.g. direct irradiation from the
sun) can raise the temperature above acceptable limits. In extreme conditions heat-
ing, or cooling units may be required. (This includes “cold-starts” for PLCs before
their semiconductors heat up).
- Shock and Vibration - The nature of most industrial equipment is to apply energy to
change workpieces. As this energy is applied, shocks and vibrations are often pro-
duced. Both will travel through solid materials with ease. While PLCs are
designed to withstand a great deal of shock and vibration, special elastomer/spring
or other mounting equipment may be required. Also note that careful consideration
of vibration is also required when wiring.
- Interference - Electromagnetic fields from other sources can induce currents.
- Power - Power will fluctuate in the factory as large equipment is turned on and off. To
page 593

avoid this, various options are available. Use an isolation transformer. A UPS
(Uninterruptable Power Supply) is also becoming an inexpensive option, and are
widely available for personal computers.

34.2.3.1 - Enclosures

• NEMA has provided a set of ratings for cabinets housing voltages less than 1000V AC. The
basic classifications are outlined below,

Type 1 - General purpose - indoors


Type 2 - Dirt and water resistant - indoors
Type 3 - Dust-tight, rain-tight and sleet(ice) resistant - outdoors
Type 3R- Rainproof and sleet(ice) resistant - outdoors
Type 3S- Rainproof and sleet(ice) resistant - outdoors
Type 4 - Water-tight and dust-tight - indoors and outdoors
Type 4X - Water-tight and Dust-tight - indoors and outdoors
Type 5 - Dust-tight and dirt resistant - indoors
Type 6 - Waterproof - indoors and outdoors
Type 6P - Waterproof submersible - indoors and outdoors
Type 7 - Hazardous locations - class I
Type 8 - Hazardous locations - class I
Type 9 - Hazardous locations - class II
Type 10 - Hazardous locations - class II
Type 11 - Gas-tight, water-tight, oiltight - indoors
Type 12 - Dust-tight and drip-tight - indoors
Type 13 - Oil-tight and dust-tight - indoors

Factor 1 2 3 3R 3S 4 4X 5 6 6P 11 12 12K 13
Prevent human contact x x x x x x x x x x x x x x
falling dirt x x x x x x x x x x x x x x
liquid drop/light splash x x x x x x x x x
airborne dust/particles x x x x x x x x
wind blown dust x x x x x x
liquid heavy stream/splash x x x x
oil/coolant seepage x x x
oil/coolant spray/splash x
corrosive environment x x x
temporarily submerged x x
prolonged submersion x

• Most factory floor applications are well suited to type 12 enclosures.


page 594

35. PROCESS MODELLING

• Instrumentation Symbols,

Table 2: ANSI/ISA-S5.1-1984 Instrumentation Symbols and Identification

LETTER FIRST LETTER SECOND LETTER

A Analysis Alarm
B Burner, Combustion User’s Choice
C User’s Choice Control
D User’s Choice
E Voltage Sensor (Primary Element)
F Flow Rate
G User’s Choice Glass (Sight Tube)
H Hand (Manually Initiated)
I Current (Electric) Indicate
J Power
K Time or Time Schedule Control Station
L Level Light (pilot)
M User’s Choice
N User’s Choice User’s Choice
O User’s Choice Orifice, Restriction
P Pressure, Vacuum Point (Test Connection)
Q Quantity
R Radiation Record or Print
S Speed or Frequency Switch
T Temperature Transmit
U Multivariable Multifunction
V Vibration, Mechanical Analysis Valve, Damper, Louver
W Weight, Force Well
page 595

Table 2: ANSI/ISA-S5.1-1984 Instrumentation Symbols and Identification

LETTER FIRST LETTER SECOND LETTER

X Unclassified Unclassified
Y Event, State or Presence Relay, Compute
Z Position, Dimen sion Driver, Actuator, Unclassified

• Line symbols include,

Capillary Tube

Electric Signal

EM, Sonic, Radioactive

Hydraulic

Pneumatic

Process

• Sensor and actuator symbols include,


page 596

FE
11 FE
11

orrifice plate
venturi or nozzle

EE FI
2 6

rotameter
magnetic

FV
11
control valve

• An example of a process diagram is given below,


page 597

35.1 REFERENCES

Paques, Joseph-Jean, “Basic Safety Rules for Using Programmable Controllers”, ISA Transac-
tions, Vol. 29, No. 2, 1990.

35.2 PRACTICE PROBLEMS


1. The best location for the PLC enclosure is:
a) close to the incoming power
b) in the control room
c) close to the machine or process
d) far away from the machine or process

(ans. c)

2. Typically, programmable controller systems installed inside an enclosure can withstand a max-
imum of:
page 598

a) 60°C outside the enclosure


b) 50°C outside the enclosure
c) 60°C inside the enclosure
d) 50°C inside the enclosure

(ans. c)

3. Input/Output racks are not typically placed:


a) adjacent to the CPU
b) beside the power supply
c) directly above the CPU
d) in a remote enclosure

(ans. c)

4. The I/O placement and wiring documents should be updated:


a) during maintenance
b) every time there is a change
c) at the end of the project
d) during the documentation

(ans. b)

5. What steps are required to replace a defective PLC?

(ans. in a rack the defective card is removed and replaced. If the card has wiring terminals these
are removed first, and connected to the replacement card.)

6. Draw the electrical schematic and panel layout for the relay logic below. The system will be
connected to 3 phase power. Be sure to include a master power disconnect.

A C
B

B
page 599

36. SELECTING A PLC

• Before a machine can be built, suitable components must be specified and ordered.

• Criteria for evaluation can be listed


- Rack or shoebox
- # of inputs/outputs (digital)
- Memory - Often 1K and up. Need is dictated by size of ladder logic program. A ladder
element will take only a few bytes, and will be specified in manufacturers docu-
mentation.
- # of I/O modules - When doing some exotic applications, a large number of special add-
on cards may be required.
- Scan Time - The time to execute ladder logic elements. Big programs or faster processes
will require shorter scan times. And, the shorter the scan time, the higher the cost.
Typical values for this are 1 microsecond per simple ladder instruction
- Communications - Serial and networked connections allow the PLC to be programmed
and talk to other PLCs. The needs are determined by the application.
- Software - Availability of programming software and other tools determines the pro-
gramming and debugging ease.

• To select a PLC the basic steps are,


1. Understand the process to be controlled (Note: This is done using the design sheets used
in the labs.)
- list the number and types of inputs and outputs.
- determine how the process is to be controlled.
- determine special needs such as distance between parts of the process.
2. If not already specified, a single vendor should be selected. Factors that might be con-
sidered are, (Note: Vendor research may be needed here.)
- manuals and documentation
- support while developing programs
- the range of products available
- support while troubleshooting
- shipping times for emergency replacements
- training
- the track record for the company
- business practices (billing, upgrades/obsolete products,etc.)
3. Plan the ladder logic for the controls. (Note: Use the standard design sheets.)
4. Count the program instructions and enter the values into the sheets below. Use the
instruction times and memory requirements for each instruction to determine if the
PLC has sufficient memory, and if the response time will be adequate for the pro-
cess.
page 600

PLC MEMORY TIME ESTIMATES - Part A

Project ID:

Name:

Date:

Instruction Time Time Instruction Instruction Instruction Total Min. Max.


Type Max Min. Memory Data Count Memory Time Time
(us) (us) (words) (words) (number) (words) (us) (us)

contacts

outputs

timers

counter

Total
page 601

PLC MEMORY TIME REQUIREMENTS - Part B

Project ID:

Name:

Date:

TIME

Input Scan Time us


Output Scan Time us
Overhead Time us
Program Scan Time us
Communication Time us
Other Times us
TOTAL us

MEMORY

Total Memory words


Other Memory words
TOTAL words bytes
page 602

Typical values for an Allen-Bradley micrologix controller are,


input scan time 8us
output scan times 8us
housekeeping 180us
overhead memory for controller 280 words

Some Basic Instructions

Instruction Time Time Instruction Instruction


Type Max Min. Memory Data
(us) (us) (words) (words)

CTD - count down 27.22 32.19 1 3


CTU- count up 26.67 29.84 1 3
XIC - normally open contact 1.72 1.54 .75 0
XIO - normally closed contact 1.72 1.54 .75 0
OSR - one shot relay 11.48 13.02 1 0
OTE - output enable 4.43 4.43 .75 0
OTL - output latch 3.16 4.97 .75 0
OTU - output unlatch 3.16 4.97 .75 0
RES - reset 4.25 15.19 1 0
RTO - retentative on time 27.49 38.34 1 3
TOF - off timer 31.65 39.42 1 3
TON - on timer 30.38 38.34 1 3
page 603

Typical values for an Allen-Bradley PLC-5 controller are,


input scan time ?us
output scan times ?us
housekeeping ?us
overhead memory for controller ? words

Some Basic Instructions

Instruction Time Time Instruction Instruction


Type Max Min. Memory Data
(us) (us) (words) (words)

CTD - count down 3.3 3.4 3 3


CTU- count up 3.4 3.4 3 3
XIC - normally open contact 0.32 0.16 1 0
XIO - normally closed contact 0.32 0.16 1 0
OSR - one shot relay 6.2 6.0 6 0
OTE - output enable 0.48 0.48 1 0
OTL - output latch 0.48 0.16 1 0
OTU - output unlatch 0.48 0.16 1 0
RES - reset 2.2 1.0 3 0
RTO - retentative on time 4.1 2.4 3 3
TOF - off timer 2.6 3.2 3 3
TON - on timer 4.1 2.6 3 3

5. Look for special program needs and check the PLC model. (e.g. PID)
6. Estimate the cost for suitable hardware, programming software, cables, manuals, train-
ing, etc., or ask for a quote from a vendor.

36.1 SPECIAL I/O MODULES

• Counters,
• each card will have 1 to 16 counters generally.
• typical sample speeds 200KHz
• often allow count up/down
• the counter can be set to zero, or up/down, or gating can occur with an external input.
page 604

• High Speed Counter - When pulses are too fast to be counted during normal PLC ladder scans, a
special counter can be used that will keep track of the pulses.

• Position controller - A card that will drive a motor (servo motor or stepper motor), and use feed-
back of the motor position to increase accuracy (feedback is optional with stepper motors).

• Voice Recognition/Speech - In some cases verbal I/O can be useful. Speech recognition methods
are still very limited, the user must control their speech, and background noise causes prob-
lems.

• Thermocouple - Thermocouples can be used to measure temperature, but these low voltage
devices require sensitive electronics to get accurate temperature readings.

• Analog Input/Output - These cards measure voltages in various ranges, and allow monitoring of
continuous processes. These cards can also output analog voltages to help control external pro-
cesses, etc.

• PID modules
• There are 2 types of PID modules. In the first the CPU does the calculation, in the sec-
ond, a second controller card does the calculation.
- when the CPU does the calculation the PID loop is slower.
- when a specialized card controls the PID loop, it is faster, but it costs less.
• Typical applications - positioning workpieces.

• Programmers - There are a few basic types of programmers in use. These tend to fall into 3 cate-
gories,
1. Hand held units (or integrated) - Allow programming of PLC using a calculator type
interface. Often done using mnemonics.
2. Specialized programming units - Effectively a portable computer that allows graphical
editing of the ladder logic, and fast uploading/downloading/monitoring of the
PLC.
3. PLC Software for Personal Computers - Similar to the specialized programming units,
but the software runs on a multi-use, user supplied computer. This approach is typ-
ically preferred over 2.

• Man Machine Interface - A-B/Siemens/Omron/Modicon/etc offer human interface systems. The


user can use,
• touch screens
• screen and buttons
• LCD/LED and buttons
• keypad to talk to PLC

• PLC CPU’s - A wide variety of CPU’s are available, and can often be used interchangeably in
the rack systems. the basic formula is price/performance. The table below compares a few
CPU units in various criteria.
page 605

PLC Siemens Siemens Siemens Siemens AEG


S5-90U S5-100U S5-115U CPU03 PC-A984-145
(CPU 944)
FEATURE
RAM (KB) 4 <= 20 96 20 8
Scan times (us)
per basic instruc. 0.8 5
overhead 2000

Package mini-module mini-module card card


Power Supply 24 VDC 24 VDC 24 VDC 115/230VAC
Maximum Cards 6 with addon
Maximum Racks N/A
Maximum Drops
Distance 2.5m or 3km

Counters 128
Timers 128
Flags 2048

I/O - Digital
on board 16 0 0 0 0
maximum 208 448 1024 256 256
I/O - Analog
on board 0 0 0 0
maximum 16 32 64 32

Communication
network Sinec-L1 Sinec-L1 Sinec-L1, prop. Sinec-L1 Modbus/Modubs+
line printer,
human ASCII
other

Functions
PID option option option

Legend:
prop. - proprietary technology used by a single vendor
option - the vendor will offer the feature at an additional cost
page 606

• Specialty cards for IBM PC interface.


- Siemens/Allen-Bradley/ etc have cards that fit into IBM buses, and will communicate
with PLC’s.

• IBM PC computer cards - An IBM compatible computer card that plugs into a PLC bus, and
allows use of common software
• Siemens CP580 the Simatic AT
- 1 com port (RS-232C)
- 1 serial port (?)
- 1 RS-422 serial port
- RGB monitor driver (VGA)
- keyboard
- 3.5” disk
- TTY interface
- 9 pin RS-232C mouse

• Diagnostic Modules
• Plug in and all they do is watch for trouble.

• Short distance RF transmitters,


• e.g., Omron V600/V620 ID system
• a basic method for transmission of a text based message
• tags on parts carry message
• transceivers receive and transmit changes.
• ID Tags - Special “tags” can be attached to products, and as they pass within range of
pickup sensors, they transmit an ID number, or a packet of data. This data can then
be used, updated, and rewritten to the tags by the PLC

• Ethernet/modem cards for communication with remote computers. This is now an option on
many CPUs

• Thumb Wheel Module - this allows numbers to be dialed in on wheels with digits from 0 to 9.
The values are read as BCD.

• BCD input/output module - allows numbers to be output/input in BCD.

• TTL input/outputs - when dealing with lower TTL voltages (0-5Vdc) most input cards will not
recognize these. These cards allow switching of these voltages.

• Encoder counter module - this module will take inputs from an encoder and track position. This
allows encoder changes that are much faster than the PLC.

• BASIC module - allows the user to write programs in the BASIC programming language.

• ASCII module - adds an serial port for communicating with standard serial ports RS-232/422.
page 607

• Stepper motor - Allows control of a stepper motor from a PLC rack.

• Servo control module - has an encoder and amplifier pair built in to the card.

• Communications - this allows communications or networks protocols in addition to what is


available on the PLC. This includes DH+, etc.

36.2 PLC PROGRAMMING LANGUAGES

• Ladder Logic is obvious, other standards are emerging, or are less common.

• Typical standards are (beyond ladder logic),


• Basic
-
-
• ‘C’
• Siemens S5 option
• Mnemonics
• Siemens
• Graphcet
• SFC’s
• Siemens
• Allen Bradley

36.3 ISSUES

36.4 PRACTICE PROBLEMS

1. What is the most commonly used type of I/O interface?


a) Analog
b) Discrete inputs
c) Output modules
d) Discrete I/O

(ans. d)

2. TRUE or FALSE -- 1K is larger when speaking about memory than when speaking to commu-
nication speeds.
page 608

(ans. true)

3. A modular PLC is best described as,


a) a highly expandable controller.
b) an all in one controller.
c) about the size of a lawnmower.
d) a modular system.

(ans. b)

12. What factors affect the selection of the size of a PLC.


page 609

37. PLC REFERENCES

37.1 SUPPLIERS

Asea Industrial Systems, 16250 West Glendale Dr., New Berlin, WI 53151, USA.
Adaptek Inc., 1223 Michigan, Sandpoint, ID 83864, USA.
Allen Bradley, 747 Alpha Drive, Highland Heights, OH 44143, USA.
Automation Systems, 208 No. 12th Ave., Eldridge, IA 52748, USA.
Bailey Controls Co., 29801 Euclid Ave., Wickliffe, OH 44092, USA.
Cincinatti Milacron, Mason Rd. & Rte. 48, Lebanon, OH 45036, USA.
Devilbiss Corp., 9776 Mt. Gilead Rd., Fredricktown, OH 43019, USA.
Eagle Signal Controls, 8004 Cameron Rd., Austin, TX 78753, USA.
Eaton Corp., 4201 North 27th St., Milwaukee, WI 53216, USA.
Eaton Leonard Corp., 6305 ElCamino Real, Carlsbad, CA 92008, USA.
Foxboro Co., Foxboro, MA 02035, USA.
Furnas Electric, 1000 McKee St., Batavia, IL 60510, USA.
GEC Automation Projects, 2870 Avondale Mill Rd., Macon, GA 31206, USA.
General Electric, Automation Controls Dept., Box 8106, Charlottesville,VA 22906, USA.
General Numeric, 390 Kent Ave., Elk Grove Village, IL 60007, USA.
Giddings & Lewis, Electrical Division, 666 South Military Rd., Fond du Lac, WI 54935-
7258, USA.
Gould Inc., Programmable Control Division, PO Box 3083, Andover, MA 01810, USA.
Guardian/Hitachi, 1550 W. Carroll Ave., Chicago, IL 60607, USA.
Honeywell, IPC Division, 435 West Philadelphia St., York, PA 17404, USA.
International Cybernetics Corp., 105 Delta Dr., Pittsburgh, Pennsylvania, 15238, USA,
(412) 963-1444.
Keyence Corp. of America, 3858 Carson St., Suite 203, Torrance, CA 90503, USA, (310)
540-2254.
McGill Mfg. Co., Electrical Division, 1002 N. Campbell St., Valparaiso, IN 46383, USA.
Mitsubishi Electric, 799 N. Bierman CircleMt. Prospect, IL 60056-2186, USA.
Modicon (AEG), 6630 Campobello Rd., Mississauga, Ont., Canada L5N 2L8, (905) 821-
8200.
Modular Computer Systems Inc., 1650 W. McNabb Rd., Fort Lauderdale, FL 33310,
USA.
Omron Electric, Control Division, One East Commerce Drive, Schaumburg, IL 60195,
USA.
Reliance Electric, Centrl. Systems Division, 4900 Lewis Rd., Stone Mountain, GA 30083,
USA.
Siemens, 10 Technology Drive, Peabody, MA 01960, USA.
Square D Co., 4041 N. Richards St., Milwaukee, WI 53201, USA.
Struthers-Dunn Systems Division, 4140 Utica Ridge Rd., Bettendorf, IA 52722, USA.
Telemechanique, 901 Baltimore Blvd., Westminster, MD 21157, USA.
Texas Instruments, Industrial Control Dept., PO Drawer 1255, Johnson City, IN 37605-
page 610

1255, USA.
Toshiba, 13131 West Little York Rd., Houston, TX 77041, USA.
Transduction Ltd., Airport Corporate Centre, 5155 Spectrum Way Bldg., No. 23, Missis-
sauga, Ont., Canada, L4W 5A1, (905) 625-1907.
Triconex, 16800 Aston St., Irvine, CA 92714, USA.
Westinghouse Electric, 1512 Avis Drive, Madison Heights, MI 48071.

37.2 PROFESSIONAL INTEREST GROUPS

American National Standards Committee (ANSI), 1420 Broadway, Ney York, NY 10018,
USA.
Electronic Industries Association (EIA), 2001 I Street NW, Washington, DC 20006, USA.
Institute of Electrical and Electronic Engineers (IEEE), 345 East 47th St., New York, NY
10017, USA.
Instrument Society of America (ISA), 67 Alexander Drive, Research Triangle Park, NC
27709, USA.
International Standards Organization (ISO), 1430 Broadway, New York, NY 10018, USA.
National Electrical Manufacturers Association (NEMA), 2101 L. Street NW, Washington,
DC 20037, USA.
Society of Manufacturing Engineers (SME), PO Box 930, One SME Drive, Dearborn, MI
48121, USA.

37.3 PLC/DISCRETE CONTROL REFERENCES

- The table below gives a topic-by-topic comparison of some PLC books. (H=Good coverage,
M=Medium coverage, L=Low coverage, Blank=little/no coverage).
page 611

Table 3:

Continuous Sensors/Actuators

Function Block Programming


Structured Text Programming

Data Interfacing/Networking
Discrete Sensors/Actuators

Implementation/Selection
Timers/Counters/Latches
Sequential Logic Design
Introduction/Overview

Advanced Functions

pages on PLC topics


Continuous Control
Conditional Logic

Fuzzy Control
Numbering

Analog I/O
Wiring
Author

Filer... H M L H M H M H M M 303
Chang... M L L L L M M L 80
Petruzela H H M H H H L H L L L L 464
Swainston H L L L L M H M M M M M 294
Clements H M L L L L L L L L M H 197
Asfahl L H L L L L 86
Bollinger.. L M M M M M H H H 52
Boucher M L M L M M H L L M M H 59

Asfahl, C.R., “Robots and Manufacturing Automation”, second edition, Wiley, 1992.
Batten, G.L., Programmable Controllers: Hardware, Software, and Applications, Second
Edition, McGraw-Hill, 1994.
Batten, G.L., Batten, G.J., Programmable Controllers: Hardware, Software, and Applica-
tions,
page 612

*Bertrand, R.M., “Programmable Controller Circuits”, Delmar, 1996.


Bollinger, J.G., Duffie, N.A., “Computer Control of Machines and Processes”, Addison-
Wesley, 1989.
Bolton, w., Programmable Logic Controllers: An Introduction, Butterworth-Heinemann,
1997.
Bryan, L.A., Bryan, E.A., Programmable Controllers, Industrial Text and VideoCompany,
1997.
Boucher, T.O., “Computer Automation in Manufacturing; An Introduction”, Chapman and
Hall, 1996.
*Bryan, L.A., Bryan, E.A., Programmable Controllers, Industrial Text Company, 19??.
*Carrow, R.A., “Soft Logic: A Guide to Using a PC As a Programmable Logic Control-
ler”, McGraw Hill, 1997.
Chang, T-C, Wysk, R.A., Wang, H-P, “Computer-Aided Manufacturing”, second edition,
Prentice Hall, 1998.
Clements-Jewery, K., Jeffcoat, W., “The PLC Workbook; Programmable Logic Control-
lers made easy”, Prentice Hall, 1996.
*Cox, R., Technician’s Guide to Programmable Controllers, Delmar Publishing, 19??.
?Crispin, A.J., “Programmable Logic Controllers and Their Engineering Applications”,
Books Britain, 1996.
*Dropka, E., Dropka, E., “Toshiba Medium PLC Primer”, Butterworth-Heinemann, 1995.
*Dunning, G., “Introduction to Programmable Logic Controllers”, Delmar, 1998.
Filer, R., Leinonen, G., “Programmable Controllers and Designing Sequential Logic“,
Saunders College Publishing, 1992.
**Hughes, T.A., “Programmable Controllers (Resources for Measuremwnt and Control
Series)”, Instrument Society of America, 1997.
?Johnson, D.G., “Programmable Controllers for Factory Automation”, Marcel Dekker,
1987.
*Lewis, R.W., “Programming Industrial Control Systems using IES1131-3”,
*Lewis, R.W., Antsaklis, P.J., “Programming Industrial Control Systems Using IEC 1131-
3 (Iee Control Engineering, No. 59)”, Inspec/IEE, 1995.
*Michel, G., Duncan, F., “Programmable Logic Controllers: Architecture and Applica-
tion”, John Wiley & Sons, 1990.
?Morriss, S.B., “Programmable Logic Controllers”, pub??, 2000.
?Otter, J.D., “Programmable Logic Controllers: Operation, Interfacing and Program-
ming”, ???
Parr, E.A., Parr, A., Programmable Controllers: An Engineer’s Guide, Butterworth-Heine-
mann, 1993.
*Parr, E.A., “Programmable Controllers”, Butterworth-Heinemann, 1999.
Petruzella, F., Programmable Logic Controllers, Second Edition, McGraw-Hill Publishing
Co., 1998.
*Ridley, J.E., “Introduction to Programmable Logic Controllers: The Mitsubishi Fx”, John
Wiley & Sons, 1997.
Rohner, P., PLC: Automation With Programmable Logic Controllers, International Spe-
cialized Book Service, 1996.
*Rosandich, R.G., “Fundamentals of Programmable Logic Controllers”, EC&M Books,
1997.
page 613

*Simpson, C.D., “Programmable Logic Controllers”, Regents/Prentice Hall, 1994.


Sobh, M., Owen, J.C., Valvanis, K.P., Gracanin, S., “A Subject-Indexed Bibliography of
Discrete Event Dynamic Systems”, IEEE Robotics and Applications Magazine,
June 1994, pp. 14-20.
**Stenerson, J., “Fundamentals of Programmable Logic Controllers, Sensors and Com-
munications”, Prentice Hall, 1998.
Sugiyama, H., Umehara, Y., Smith, E., “A Sequential Function Chart (SFC) Language for
Batch Control”, ISA Transactions, Vol. 29, No. 2, 1990, pp. 63-69.
Swainston, F., “A Systems Approach to Programmable Controllers”, Delmar, 1992.
Teng, S.H., Black, J. T., “Cellular Manufacturing Systems Modelling: The Petri Net
Approach”, Journal of Manufacturing Systems, Vol. 9, No. 1, 1988, pp. 45-54.
Warnock, I., Programmable Controllers: Operation and Application, Prentice Hall, 19??.
**Webb, J.W., Reis, R.A., “Programmable Logic Controllers, Principles and Applica-
tions”, Prentice Hall, 1995.
Wright, C.P., Applied Measurement Engineering, Prentice-Hall, New Jersey, 1995.
page 614

38. USING THE OMRON DEMO PACKAGE

38.1 OVERVIEW

• This software is a limited version of the full software package. Omron distributes it for market-
ing purposes, but we may use it to practice PLC usgae. The limitations for the software are,
- Data Creation Libraries cannot be created.
- Nothing can be saved on disk.
- Only the first two pages of printouts can be done.
- The maximum connection time to the PLC is 10 minutes.

• The software will run on IBM compatible computers with 640 KB of memory and 2M of disk
space.

38.1.1 Installation

• The disk has an installation program on it. The steps to follow are,
1. Put the disk in the drive (A:), after the computer is on.
2. Change to the A: drive,
cd A:
3.(color displays) Run the install program,
install
3.(black and white displays) Run the install program,
install /B
4. Answer all questions (or hit return for defaults) and when done remove the disk from
the computer.

38.1.2 Basic Use

1. Run the software,


cd c:\lssdemo
lss
2. The setup menu should be displayed. The first step is to ensure the menu displays the
correct values.
PC Model (C200H)
Host Link Unit (00)
Network Address (NET000)(NODE001)(BIN)
Data Disk Drive (A)
PC Interface (HostLink)(Port1)(9600)
page 615

Coil Comments (Circmnt)


Printer (Wide carriage graphics)
Eprom Interface (Port1)(9600)
Display Type (Color)

To change one of these values you may,

a) use the cursor keys to move to it, then press return.


b) select the letter in front of the choice, using the keyboard.

3. Some options for programming control are,

<CNTL>H help
<ESC> backs up or ends
<END> brings up programming menu

4. Clear the programming menu. At this point the software is NOT connected to the PLC. After
selecting the choices below, the memory will be cleared, and there will be no old PLC pro-
grams in memory.

[Programming]
C: Clear Memory<ENTER>
O<ENTER>

(Note: the way the menu is layed out the [] brackets are a main menu, the line
below is a choice from the menu, and any following choices will be listed
after these two.)

5. To create a new program we must put the PLC in write mode, press <F2>. Attention should be
drawn to the top, and bottom of the screen, the bottom will show function key based com-
mands, and the top of the screen will show the user the current operation mode.

6. We will enter the following ladder,


page 616

100 105
200

102 106 201

201

END
(01)

a) Look at the bottom of the screen. Notice a NO contact is <F4>, press this to start. Next
enter ‘100’ and watch the symbol at the bottom of the screen. When you press
return the symbol at the bottom of the screen will be added to the ladder logic. The
cursor will now move to the next position that the next ladder logic element will be
added at. (If you have made a mistake, please continue for now, and we will learn
how to correct these later.)
b) To make the NC contact, we must first select a NO <F4> and then use a NOT <F9>.
Notice the NC on the bottom of the screen. Now enter the address ‘105’ and accept
the contact. (Note: <ENTER> is not always specified, and is often assumed.)
c) Create an output coil by pressing <F7> and enter ‘200’. A full ladder rung will now
appear on the screen, and the cursor will appear on the next free line.
d) Start entering the next line of ladder with,
<F4>102
<F4>108
<F7>201
This will result in all but the branched NO contact. To put this in, use the branched contact
symbol,
<F5>201
7. Next, an end line MUST be entered (always end all programs with this, if it is not
present, many problems will occur.
move the cursor to the start of the next line.
<F10>01
The END is considered one of many special functions, refer to the special function num-
ber table for more codes. (Note: Although this appraoch is awkward, it would be
more difficult to do most other ways.)
page 617

8. A mistake was intentionally made during entry. To correct this we use the cursor keys to
move back to the problem element. When it is highlighted by the cursor it may be
changed (it will also appear at the bottom of the screen).
a) move to NO108, this should be NO106.
b) if 00108 is shown at the bottom of the screen, type,
00106<ENTER>

9. The program should now be complete. Whenever a program has been changed, it must
be stored first.
<F3><ENTER>
While storing, logic is checked, and the top of the screen flashes. If the program has stored
correctly, the main screen will go blank. You can put the LSS software in read
mode and look at the logic.
<F1>
<PGUP><PGUP><PGUP>

38.1.3 Connecting to the PLC

• Up to this point the program has been running by itself. Next we must connect to the PLC, and
send our program,
<CNTL>O

• A new menu appears at the bottom of the screen. From this select PC connect.
<F!>

• The top of the screen will indicate that you are connected, and the PLC mode.

• The PLC may, or may not, be running a program. But, to send a new program, the PLC must be
in programming mode.
<CNTL>O<F4>

• Next, you must send the program to the PLC. Bring up the main menu,
<CNTL>M
P: Tranfer Program
R: PC->Computer
E: Send to end

• At this point the program should be in the PLC and can be run,
<CNTL>O
<F2>

• If <PGUP> is pressed a few times, the ladder will appear on the screen. And, as inputs and out-
puts are activated, it will be shown on the screen.
page 618

38.2 REFERENCE GUIDE FOR OMRON PLC DEMO SOFTWARE

************** Append PLC pocket reference guide.


page 619

39. INDUSTRIAL ROBOTICS

39.1 INTRODUCTION

• The nice definition (by the Robot Institute of America): “A robot is a reprogrammable multi-
functional manipulator designed to move material, parts, tools, or specialized devices through
variable programmed motions for the performance of a variety of tasks”

• The not-so-nice definition: Robots are one armed, blind, stupid, deaf, mute, and cannot feel and
understand what they are doing.

39.1.1 Basic Terms

Links and Joints - Links are the solid structural members of a robot, and joints are the movable
couplings between them.

Degree of Freedom (dof) - Each joint on the robot introduces a degree of freedom. Each dof can
be a slider, rotary, or other type of actuator. Robots typically have 5 or 6 degrees of freedom. 3
of the degrees of freedom allow positioning in 3D space, while the other 2or 3 are used for ori-
entation of the end effector. 6 degrees of freedom are enough to allow the robot to reach all
positions and orientations in 3D space. 5 dof requires a restriction to 2D space, or else it limits
orientations. 5 dof robots are commonly used for handling tools such as arc welders.

Orientation Axes - Basically, if the tool is held at a fixed position, the orientation determines
which direction it can be pointed in. Roll, pitch and yaw are the common orientation axes used.
Looking at the figure below it will be obvious that the tool can be positioned at any orientation
in space. (imagine sitting in a plane. If the plane rolls you will turn upside down. The pitch
changes for takeoff and landing and when flying in a crosswind the plane will yaw.)

yaw
roll
yaw

top
forward front pitch
pitch
roll

right

Position Axes - The tool, regardless of orientation, can be moved to a number of positions in
space. Various robot geometries are suited to different work geometries. (more later)
page 620

Tool Centre Point (TCP) - The tool centre point is located either on the robot, or the tool. Typi-
cally the TCP is used when referring to the robots position, as well as the focal point of the
tool. (e.g. the TCP could be at the tip of a welding torch) The TCP can be specified in carte-
sian, cylindrical, spherical, etc. coordinates depending on the robot. As tools are changed we
will often reprogram the robot for the TCP.

TCP
(Tool Center Point)

Work envelope/Workspace - The robot tends to have a fixed, and limited geometry. The work
envelope is the boundary of positions in space that the robot can reach. For a cartesian robot
(like an overhead crane) the workspace might be a square, for more sophisticated robots the
workspace might be a shape that looks like a ‘clump of intersecting bubbles’.
page 621

Workspace

Speed - refers either to the maximum velocity that is achievable by the TCP, or by individual
joints. This number is not accurate in most robots, and will vary over the workspace as the
geometry of the robot changes (and hence the dynamic effects). The number will often reflect
the maximum safest speed possible. Some robots allow the maximum rated speed (100%) to be
passed, but it should be done with great care.

Payload - The payload indicates the maximum mass the robot can lift before either failure of the
robots, or dramatic loss of accuracy. It is possible to exceed the maximum payload, and still
have the robot operate, but this is not advised. When the robot is accelerating fast, the payload
should be less than the maximum mass. This is affected by the ability to firmly grip the part, as
well as the robot structure, and the actuators. The end of arm tooling should be considered part
of the payload.

Repeatability - The robot mechanism will have some natural variance in it. This means that when
the robot is repeatedly instructed to return to the same point, it will not always stop at the same
position. Repeatability is considered to be +/-3 times the standard deviation of the position, or
where 99.5% of all repeatability measurements fall. This figure will vary over the workspace,
especially near the boundaries of the workspace, but manufacturers will give a single value in
specifications.
page 622

Accuracy - This is determined by the resolution of the workspace. If the robot is commanded to
travel to a point in space, it will often be off by some amount, the maximum distance should be
considered the accuracy. This is an effect of a control system that is not necessarily continuous.

Settling Time - During a movement, the robot moves fast, but as the robot approaches the final
position is slows down, and slowly approaches. The settling time is the time required for the
robot to be within a given distance from the final position.

Control Resolution - This is the smallest change that can be measured by the feedback sensors, or
caused by the actuators, whichever is larger. If a rotary joint has an encoder that measures
every 0.01 degree of rotation, and a direct drive servo motor is used to drive the joint, with a
resolution of 0.5 degrees, then the control resolution is about 0.5 degrees (the worst case can be
0.5+0.01).

Coordinates - The robot can move, therefore it is necessary to define positions. Note that coordi-
nates are a combination of both the position of the origin and orientation of the axes.

y
P = ( x, y, z )
y
x
z

World Coordinates - this is the position of the tool measured


relative to the base, the orientation of the tool is assumed to
x
be the same as the base.

y
P = ( x, y, z )
y
z x

Tool Coordinates - here the tool orientation is considered, and


the coordinates are measured against a frame attached to
x
the tool

z
page 623

θ3

θ2

θ1

Joint Coordinates - the position of each joint (all angles here)


are used to describe the position of the robot.

39.1.2 Positioning Concepts

39.1.2.1 - Accuracy and Repeatability

• The accuracy and repeatability are functions of,


- resolution- the use of digital systems, and other factors mean that only a limited number
of positions are available. Thus user input coordinates are often adjusted to the
nearest discrete position.
- kinematic modeling error - the kinematic model of the robot does not exactly match the
robot. As a result the calculations of required joint angles contain a small error.
- calibration errors - The position determined during calibration may be off slightly, result-
ing in an error in calculated position.
- random errors - problems arise as the robot operates. For example, friction, structural
bending, thermal expansion, backlash/slip in transmissions, etc. can cause varia-
tions in position.

• Accuracy,
• “How close does the robot get to the desired point”
• This measures the distance between the specified position, and the actual position of the
robot end effector.
• Accuracy is more important when performing off-line programming, because absolute
coordinates are used.

• Repeatability
• “How close will the robot be to the same position as the same move made before”
• A measure of the error or variability when repeatedly reaching for a single position.
page 624

• This is the result of random errors only


• repeatability is often smaller than accuracy.

• Resolution is based on a limited number of points that the robot can be commanded to reach for,
these are shown here as black dots. These points are typically separated by a millimeter or less,
depending on the type of robot. This is further complicated by the fact that the user might ask
for a position such as 456.4mm, and the system can only move to the nearest millimeter,
456mm, this is the accuracy error of 0.4mm.

• In a perfect mechanical situation the accuracy and control resolution would be determined as
below,
page 625

The manipulator may stop at


a number of discrete positions

One axis on
a surface

accuracy accuracy

control resolution

specified locations

In an ideal situation the manipulator would stop at the specified locations.


Here the accuracy would be half of the control resolution. The control
resolution would be the smallest divisions that the workspace could be
divided into (often by the resolution of digital components.

• Kinematic and calibration errors basically shift the points in the workspace resulting in an error
‘e’. Typically vendor specifications assume that calibration and modeling errors are zero.

error ‘e’

Should
be here

• Random errors will prevent the robot from returning to the exact same location each time, and
this can be shown with a probability distribution about each point.
page 626

System specified
position ‘S’
User requested
position ‘U’

accuracy ‘a’

repeatability = 6s

control resolution
a = ------------------------------------------ e max = a + modeling error + 3s
2
If the distribution is normal, the limits for repeatability are typically chosen as ±3 stan-
dard deviations ‘s’.

We can look at distributions for each specified position for the robot end effector in rela-
tionship to other point distributions. This will give us overall accuracy, and spatial res-
olution.

controlled points ‘S’

requested point ‘U’

worst case for a point

worst case spatial resolution

• The fundamental calculations are,


page 627

S U
σ

repeatability = ±r = 3s

accuracy = ( S – U ) + e

39.1.2.2 - Control Resolution

• Spatial resolution is the smallest increment of movement into which the robot can divide its
work volume. Spatial resolution depends on two factors: the systems control resolution and the
robots mechanical inaccuracies. It is easiest to conceptualize these factors in terms of a robot
with 1 degree of freedom.

• Control resolution - is determined by the robot’s position control system and its feedback mea-
surement system. It is the controllers ability to divide the total range of movement for the par-
ticular joint into individual increments that can be addressed in the controller. The increments
are sometimes referred to as “addressable parts”. The ability to divide the joint range into
increments depends on the bit storage capacity in the control memory. The number of separate,
identifiable increments (addressable points) for a particular axis is,

n
# of increments = 2 where n is the number of control bits

• example - A robot with 8 bit control resolution can divide a motion range into 256 discrete posi-
tions. The control resolution is about (range of motion)/256. The increments are almost always
uniform and equal.

• If mechanical inaccuracies are negligible, Accuracy = Control Resolution/2


page 628

39.1.2.3 - Payload

• The payload is always specified as a maximum value, this can be before failure, or more com-
monly, before serious performance loss.

• Static considerations,
- gravity effects cause downward deflection of the arm and support systems
- drive gears and belts often have noticeable amounts of slack (backlash) that cause posi-
tioning errors
- joint play (windup) - when long rotary members are used in a drive system and twist
under load
- thermal effects - temperature changes lead to dimensional changes in the manipulator

• Dynamic considerations,
- acceleration effects - inertial forces can lead to deflection in structural members. These
are normally only problems when a robot is moving very fast, or when a continu-
ous path following is essential. (But, of course, during the design of a robot these
factors must be carefully examined)

• e.g.
Consider a steel cantilever beam of length L, width B and height H, fixed at one end and
with a force P, applied at the free end due to the gravitational force on the load.

P
L
B
H

δ = deflection of beamtip caused by point load


3 6
PL E = Youngs modulus = 30 ×10 (psi)
δ = ---------
3EI
3
BH
I = ---------- for rectangular beam
12
**Note: this deflection does not include the mass
of the beam, as might be important in many
cases.
page 629

1a. Gravity Effects (payload)

Say, P = 100(lbs)
L = 60(in)
B = 4 (in)
H = 6 (in)
∴δ payload = 0.0033 (in)
If accuracy = 0.01 then the gravity effects are less
If accuracy = 0.001 then the gravity effects are too large

Aside: Note that the length has a length cubed effect on the tip deflection,
so if a second similar link was added to the robot, the deflection would
increase 8 times, a third link would increase deflection by 81 times.

1b. Gravity effects (robot link mass)


4
ωL
ω = ---------------- = 0.91  -----
weight lb
δ = ----------
8EI length in
∴δ link mass = 0.00066 (in)

δ total = 0.0033 + 0.00066 = 0.00396

Aside: If the deflection were too large, then we could use lighter link
materials, or larger annular (round tubular) members. Annular
members allow actuators, and instrumentation inside.
page 630

2. Drive Gear and Belt Drive Play


assume we are using gears, or timing belts, that do not mesh perfectly

The gears do not mesh perfectly, and the resulting space


is ‘D’
The input drive has to move a distance ‘D’ before the output engages, and motion
begins (this is often after a direction change). This error is multiplied by the
gear ratio between input gears and the final position of the robot arm. Similar
errors occur for chains, belts, and other types of errors.

Aside: Some errors can be taken out of the system by using very
precise gearing, or anti-backlash gearing that uses springs to
hold the input gear against the drive gear. It is also possible
to compensate for this in software.
With good gearing, Backlash can be held to less than 0.010 (in), but special
design is required when accuracies of 0.001 (in) are desired.

3. Joint Flexibility - ( the angular twist of the joints, rotary drives, shafts, under the load)

32LT-
θ = --------------
4
θ = twist of the cantilevered link in radians
πD G
L = distance of the applied moment from the fixed end
T = the applied moment
G = the polar moment of inertia
D = the effective diameter of application of the moment
page 631

4. Thermal effects
δ thermal = α∆TL α = coefficient of linear thermal expansion

If for the previous values we consider,

α = 6.5 ×10  --------- ( for steel )


– 6 in
inF
∆T = T 1 (working temp.) – T 0 (calib. temp.) = 80F – 60F = 20F
δ thermal = 0.0078 (in)

Major errors in accuracy can result from thermal expansion/contraction

5. Acceleration Effects
The robot arm, and payload are exposed to forces generated by accelera-
tion.This applies mainly to the payload mass, but also to the link mass.
These forces cause bending moments that must be added to the masses con-
sidered before.
F payload = M payload r payload ω' F link = M link r centroid ω'(approximate)

The robot arm also experiences radial forces due to centripetal forces. These
lead to elongation of the arm, but are often negligible.

2
Fpayload = M payload r payload ω

And, if the centre of rotation moves, we must also consider coriolis forces,
these could potentially result in a ‘whip’ effect. This does occur in multi-
link robots.
3
F payload L
δ = ------------------------
3EI

6. Combine cartesian components of deflection into one vector

2 2 2
δ accuracy = ( ∑ δ xi ) + ( ∑ δ yi ) + ( ∑ δ zi )

*** Remember to compare to control resolution


page 632

39.2 ROBOT TYPES

39.2.1 Basic Robotic Systems

• The basic components of a robot are,


Structure - the mechanical structure (links, base, etc). This requires a great deal of mass to
provide enough structural rigidity to ensure minimum accuracy under varied pay-
loads.
Actuators - The motors, cylinders, etc. that drive the robot joints. This might also include
mechanisms for a transmission, locking, etc.
Control Computer - This computer interfaces with the user, and in turn controls the robot
joints.
End of Arm Tooling (EOAT) - The tooling is provided be the user, and is designed for spe-
cific tasks.
Teach pendant - One popular method for programming the robot. This is a small hand held
device that can direct motion of the robot, record points in motion sequences, and
begin replay of sequences. More advance pendants include more functionality.

Teach pendant
and/or
dumb terminal
Control
computer

RS-232 Actuator End of Arm


control power supply Mechanical Tooling
computer (hydraulic, etc) arm (EOAT)

PLC/NC
machine
memory
(battery Sensors
or eeprom)

39.2.2 Types of Robots


page 633

• Robots come in a wide variety of shapes, and configurations.

• The major classes of robots include,


arms - fixed in place, but can reach and manipulate parts and tools
mobile - these robots are free to move

39.2.2.1 - Robotic Arms

• Typical joint types are,


Revolute - rotary joints often driven by electric motors and chain/belt/gear transmissions,
or by hydraulic cylinders and levers.
Prismatic - slider joints in which the link is supported on a linear slider bearing, and lin-
early actuated by ball screws and motors or cylinders.

• Basic configurations are,


Cartesian/Rectilinear/Gantry - Positioning is done in the workspace with prismatic joints.
This configuration is well used when a large workspace must be covered, or when
consistent accuracy is expected from the robot.
Cylindrical - The robot has a revolute motion about a base, a prismatic joint for height,
and a prismatic joint for radius. This robot is well suited to round workspaces.
Spherical - Two revolute joints and one prismatic joint allow the robot to point in many
directions, and then reach out some radial distance.
Articulated/Jointed Spherical/Revolute - The robot uses 3 revolute joints to position the
robot. Generally the work volume is spherical. This robot most resembles the
human arm, with a waist, shoulder, elbow, wrist.
Scara (Selective Compliance Arm for Robotic Assembly) - This robot conforms to cylin-
drical coordinates, but the radius and rotation is obtained by a two planar links
with revolute joints.
page 634

CARTESIAN/RECTILINEAR/GANTRY

SPHERICAL
page 635

CYLINDRICAL

ARTICULATED/REVOLUTE/
JOINTED SPHERICAL
page 636

SCARA

39.2.2.2 - Autonomous/Mobile Robots

• The robots discussed up to this point have concerned ‘arms’ that are fixed to the floor. Another
important class of robots are autonomous, and free to move about the workspace.

• Typical applications are,


- nuclear accident cleanup
- planetary exploration
- Automatic Guided Vehicles in factories
- mail delivery

39.2.2.2.1 - Automatic Guided Vehicles (AGVs)

• These are typically wheeled robots that carry payloads through a factory.

• They navigate using,


- wires embedded in floors
- light sources or reflectors
- colored tapes on the floor
page 637

39.2.3 Commercial Robots

• Some specifications for commercial robots are given below

39.2.3.1 - Seiko RT 3000 Manipulator

• In general
Degrees of freedom 4
Maximum payload 5kg (11 lb)
Repeatability (based on constant temp., load, speed) +/-0.025mm (+/- 0.001 in.)
Weight 108kg (237 lb)
Operating Temperature 0C to 40C (32F to 104F)
Humidity (based on constant temp. load, speed) 20% to 90%
Power Requirements 200-240 VAC
Other 50-70 psig air

• A-axis
motion revolute
Range +/-145 degrees
Resolution 0.005 deg.
Speed
max. speed 150 deg/sec
max. torque 383. in.lbs

• Z-axis
motion linear
Range 4.72 in (120mm)
Resolution 0.0005 in (0.012mm)
Speed
max. speed 14 in/sec (360 mm/sec)
max. force 23.3-35.2 lbs (10.6-16.0 kg)

• R-axis
motion linear
Range 11.8 in (300mm)
Resolution 0.001 in (0.025mm)
Speed
max. speed 29.5 in/sec (750 mm/sec)
max. force 40 lbs

• T-axis
motion revolute
Range 290 degrees
page 638

Resolution 0.003 deg.


Speed
max. speed 90 deg/sec
max. torque 358. in.lbs

• The workspace is pictured below,

A-axis (290 deg)

R-axis (300mm)
Z-axis (120mm)

39.2.3.2 - DARL Programs

• All DARL comments follow ’ at any position on a line.

• Statements are ended with a colon, and as long as colons are used, more than one statement can
be used on a line.

• Line numbering is required for DARL programs.

• Dimensions are given in millimeters in the programs.

• Commas and spaces are treated as equivalent.

• A sample program is given below with comments for explanation,


page 639

10 SPEED 250 ‘set the speed of the robot


20 T1 = 0. -350. -50. 0. ‘ first point
30 T2 = 0. -50. -350. 0. ‘second point
40 T3 = 30. -50. -350. 30. ‘third point
50 MOVE T1:MOVE T2:MOVE T3 ‘move the gripper to different points in space
60 OUTPUT +OG0 200 ‘open gripper
70 MOVE T1 + T2 ‘add two positions and move there
70 OUTPUT +OG1 200 ‘close gripper
80 STOP

39.2.3.2.1 - Language Examples

• First, points can be defined in programs, they can also be defined by moving the robot to the
location and storing the value. This allows the robot to accurately find points without measur-
ing. It also means that points location values don’t need to appear in programs, they are stored
in memory.

• A example that uses for-next, if-then, goto and gosub-return commands is shown below. These
commands are very standard in their use.

10 FOR A = 2 TO 10 ‘ start a loop that will count from 2 to 10


40 IF A = 4 THEN GOTO 100 ‘when a has a value of 4 jump to line 100
50 IF A = 6 THEN GOSUB 200 ‘ when a has a value of 6 go to subroutine
60 NEXT A ‘ go back to line 10 and increase the value of a until it reaches 10
70 END ‘end the program
100 MOVE T1 ‘ go to point 1
110 NEXT A ‘ go back to line 10
200 MOVE T2 ‘ go to point 2
210 RETURN ‘ go back to where we left line 50

• A example that uses motion is shown below. The ‘move’ command causes a motion to another
point by only turning the needed joints. ‘moves’ causes a more complex motion resulting in a
straight line tool motion between points. ‘movec’ allows a circular interpolation dictated by
three points (the start, and the two given). The shave command forces the robot to fully com-
plete a motion and stop before going to the next point. The sync command will move the robot,
but keep the gripper in the original position relative to the real world.
page 640

10 T1 = 30. 10. 10. 40.


20 T2 = 15. 5. 5. 10.
30 T3 = 0. 0. 0. 0.
40 MOVE T1 ‘ move to a start point
50 SHAVE ‘ allow motions to “only get close” before moving to the next point
60 MOVE T2: MOVE T3 ’ slows down at t2 before going to t3
70 NOSHAVE ‘ make motion stop fully before going to the next point
80 MOVE T1 ‘ return to the start
90 MOVE T2: MOVE T3’ stops at t2 before going to t3
100 MOVE T1 ‘ return to the start
110 MOVES T2: MOVES T3 ’ moves in a straight line from t1 to t2 and from t2 to t3
120 MOVE T1 ‘ back to the start again
130 MOVEC T2 T3 ‘ follows a smooth path, not slowing down at t2
140 MOVE T1 ‘ back to the start again
150 SYNC ‘ make gripper stay stationary relative to ground
160 MOVEC T2 T3 ‘ the arm moves, but the gripper stays at 0
170 NOSYNC ‘ make gripper follow robot

• A example that defines tool location offsets is shown below. This is particularly useful for a
robot that has more than one tool attached. The normal tool location is on the end of the arm.
With multiple tools attached we will have multiple tool center points. We can have a tool defi-
nition for each one of these. Note that the x-axis is the normal forward for the tool. The tool
axis can only be changed in the x-y plane (or the plane perpendicular to the gripper rotation).

30 A = 0.1 ’ the tool center point x offset from the gripper


40 B = 0.2 ’ the tool center point y offset from the gripper
50 C = 0.3 ’ the tool center point z offset from the gripper
60 D = 1 ’ define an offset for an axis
70 E = 0 ’ define a zero offset for an axis
80 DEF TL2 D E A B C ’ tool 2 at (0.1, 0.2, 0.3) with the x-axis pointing forward (1,0)
90 DEF TL3 E D C B A ’ tool 3 at (0.3, 0.2, 0.1) with the x-axis pointing to the left (0,1)
100 TOOL 1 ’ indicate that you are using tool 1
110 MOVE T1 ’ move to position 1 with the tool pointing in the normal direction
111 remark note that the robot gripper will be positioned (-0.1, -0.2, -0.3) from normal
120 TOOL 2 ’ choose the tool on the gripper pointing to the left
130 MOVE T1 ’ this will move the robot to (-0.3, -0.2, -0.1)
140 remark the robot will also move so that the tool is pointing to the left.

• A example that uses pallet commands is shown below. Basically a pallet allows us to create an
array of points (it does the calculations). We can then give a location on a pallet and move to
page 641

that point. The basic pallet definition requires that we indicate the number of rows and col-
umns. We also need to define the physical locations of the rows and columns. We do this by
giving an origin point, and then defining where the first row and column end. To use the pallet
location we can simply refer to the pallet location index.

110 R = 3 ’ define the number of rows on the pallet


120 C = 4 ’ define the number of columns
130 DEF PA2 (R,C) T1 T2 T3 ’ pallet with first row from t1 to t2, the first column from t1
to t3
140 FOR I = 0 TO R-1 ’ loop for the rows
150 FOR J = 0 TO C-1 ’ loop for the columns
160 MOVE T4’ move the pickup point
170 OUTPUT +OG3 ’ close the gripper
180 MOVE PA2(J,I) ’ move to the location on the pallet
190 OUTPUT -OG3 ’ open the gripper
200 NEXT J: NEXT I ’ continue the loop to the next parts

• A example that defines and uses new frames is shown below. We define a new frame of refer-
ence by using points. The first point becomes the new origin. The second point determines
where the new x-axis points. The z-axis remains vertical, and the y-axis is shifted appropri-
ately.

20 T1 = 2. 1. 0. 0. ’ define a point
30 T2 = 1. 1. 0. 0.
40 T3 = 2. 2. 0. 0.
50 DEF FR1 T2 T1 ’ defines frame with origin at (1,1,0), but x-y axis in original direction
60 DEF FR3 T1 T2 ’ defines origin at T1 and x-axis pointing T2-T1=(-1,0,0)
70 DEF FR2 T2 T3 ’ defines origin at T2 and x-axis pointing T3-T2 = (.71,.71,0)
80 MOVE T2 ’ THIS WILL MOVE TO (1 1 0 0)
90 FRAME 1 ’ USE REFERENCE FRAME #1
100 MOVE T2 ’ THIS WILL MOVE TO FR1+T2 = (2, 2, 0, 0)
110 FRAME 2 ’ USE REFERENCE FRAME #2
120 MOVE T2 ’ THIS WILL MOVE TO FR2+T2 = ( 1, 0, 0, 0)
130 FRAME 3 ’ USE REFERENCE FRAME #3
140 MOVE T2 ’ THIS WILL MOVE TO FR3+T2 = (1.71, 1.71, 0, 0)
150 FRAME 0’ GO BACK TO THE MAIN COORDINATES
80 MOVE T2 ’ THIS WILL MOVE TO (1 1 0 0)

• A example that uses simple inputs and outputs is shown below. Note that there are two connec-
tors for I/O. The main or ‘E’xternal connector is on the main controller box. The other I/O lines
page 642

are on the ‘G’ripper. We can check the states of inputs and set the states of outputs. The ‘+’
sign indicates inputs/outputs high (5v) and the ‘-’ sign indicates low (0V). The ranges for input
points are ie0-ie15, ig0-ig7, and for output points oe0-15, og0-7. The search command allows
us to move the robot until an input is activated. This is useful when attempting to find a part by
touching it.

100 WAIT +IE3 ’ wait for external input #3 to turn on


110 WAIT -IG4 ’ wait for gripper input #4 to turn off
120 IF IE5 AND NOT IE6 THEN 110 ’ check to see if external input5 is on and 6 is off
130 OUTPUT +OG4 ’ turn on output #4 on the gripper
140 OUTPUT -OE4 ’ turn on output #4 on the external connector (not the gripper)
150 SEARCH +IG7 T1 THEN 200 ELSE 300 ’ move towards t1 until gripper input 7 goes on

39.2.3.2.2 - Commands Summary

• A summary of the commands is given below,

CLEAR <variable> This will clear a variable or point value. If none is spec-
ified then all the variable memory is cleared.

DEF FR <1-9> Tn Tn This command will allow the workspace axes to be


redefined.

DEF PA <0-9> (etc. For defining pallets

DEF TL <1-9> X1 Y1 X2 Defined tool offsets


Y2 Z1

DELAY <1-32767> Will delay for the specified time in milliseconds


page 643

END Specifies the end of a program.

FOR TO / NEXT Allows the standard BASIC for next loop.

FRAME Specifies a current frame of reference.

GOSUB / RETURN Functions for creating subroutines.

GOTO An unconditional jump to another line number.

HERE <Tn> Will define the current position to the location variable.

HOME Move the robot to an initial position

INPUT Fill a variable with an input from the keyboard

IF/THEN/ELSE Standard flow control commands

JOGRT Sets the robot to move in cylindrical mode

JOGSP <1-100> Sets the jogging speed

JOGXY Sets the robot to move in cartesian coordinates relative


to the current frame.
page 644

MOVE <Tn> Move to a specified position.

MOVEC <Tn> <Tn> [C] Move the robot in a circular continuous path
MOVEC <Tn> <rad> [L,C]

MOVES <Tn> Move the robot with straight line motion

NOSHAVE Sets the robot to stop fully at the end of each motion.

OD = n Sets one of the four binary output bits (0-15)

OUTPUT <+/-> Opens and closes gripper or externally connected


<OE,OGn> [10-32767] devices.

PRINT Output a structured string to the output unit or display

SHAVE Allow the robot to start the next motion before the pre-
vious one is complete.

SPEED Sets the speed of the manipulator

STOP Terminate the execution of the program.

TOOL n Set motions to be relative to a tool.

WAIT <+/-> <IE,IG> <0- Wait for a certain input condition.


15>
page 645

OUTPUT <+/-> Opens and closes gripper or externally connected


<OE,OGn> [10-32767] devices.

39.2.3.3 - Mitsubishi RV-M1 Manipulator

• In general
Degrees of freedom 5
Maximum payload 1kg (2.2 lb)
Repeatability (based on constant temp., load, speed) +/- 0.3mm
Weight 19kg (42 lb)
Operating Temperature 5C to 40C
Humidity (based on constant temp. load, speed) 10% to 85%
Power Requirements 120/220/230/240 VAC
Other 50-70 psig air

• waist
motion revolute
Range 300 degrees
Resolution ?? deg.
Speed
max. speed 120 deg/sec
max. torque ?? in.lbs

• shoulder
motion revolute
Range 130 degrees
Resolution ?? deg.
Speed
max. speed 72 deg/sec
max. torque ?? in.lbs

• elbow
motion revolute
Range 110 degrees
Resolution ?? deg.
Speed
max. speed 109 deg/sec
max. torque ?? in.lbs

• wrist pitch
motion revolute
Range +/-90 degrees
page 646

Resolution ?? deg.
Speed
max. speed 100 deg/sec
max. torque ?? in.lbs

• wrist roll
motion revolute
Range +/-180 degrees
Resolution ?? deg.
Speed
max. speed 163 deg/sec
max. torque ?? in.lbs

• The workspace is pictured below,

782mm

57mm
482mm

39.2.3.4 - Movemaster Programs

• All comments follow a semi-colon at any position on a line


page 647

• Statements are ended with a colon, and as long as colons are used, more than one statement can
be used on a line.

• Line numbering is required.

• Dimensions are given in millimeters in the programs.

• A sample program is given below with comments for explanation,

10 NT
20 SP 7 ; set speed
30 MO 10, C ;move to position 10 with the hand closed
40 MO 9, O ;move to position 9 with the hand opened
50 TI 40 ;stop for 4 seconds
60 GT 30 ;goto line 30

39.2.3.4.1 - Language Examples

• The example below shows how points are defined and used. Please be aware that point location
values are not normally defined in a program. Normally they are programmed by hand, and
then when the program is run, it refers to them by number (from 1 to 629)
page 648

10 NT ; move to the nest or neutral position, this is almost straight up


20 OG ; move to the reference or zero position
30 TL 20 ; this will set the tool length as 20mm for all cartesian position calculations
40 PD 3, 0, 350, 250, -10, -20 ; define position #3 with joint angles
50 MO 3 ; move the robot to position #3
60 DW 20,20,0; a cartesian move 20 mm in the x and 20 mm in the y directions
70 HE 4; stores the current location as position #4
80 IP; moves the tool to position #5 ; assume that positions 5-10 are already defined
90 MC 6,10 ; continuous motion through positions 6, 7, 8, 9 and then stop at point 10
100 DP; the robot moves to position #9 and stops
110 PD 11, 0, 0, 10, 0, 0 ; define a vector (point #11) with only a z component
120 MA 9, 11, O ; move away from point #9 a distance of vector #11 with gripper open
130 MJ 10, 10, 0, 0, 0 ; move the joints (shoulder and elbow) 10 degrees
140 MP 10, 20, 30, 40, 50 ; move to cartesian position (10,20,30) with roll=40,pitch=50
150 SP 3 ; set the speed low to increase accuracy
160 MS 8, 5 ; straight line motion to point #8 as approximated with 5 knot points
170 MT 8, -40 ; causes the tool to move 40mm straight back from point #8

• The example below shows how we can define and use pallets. The definition of a pallet covers a
number of lines to define the pallet size and then the location. We must also define points to
indicate where the pallet lies in space. For the example below these points would have to be
position numbers 20 (pallet origin), 21 (origin to end of first column), 22 (origin to end of first
row), 23 (origin to diagonal corner of pallet). Note: if using pallet #3 these counters would be
30-33, and point 3 would move.

20 PA 2, 3, 4 ; pallet #2 is defined as having 3 columns and 4 rows


30 SC 21, 1 ; set counter #21 for columns to 1 - each pallet # has dedicated counters
40 SC 22, 2 ; set counter #22 for rows to 2 - each pallet # has dedicated counters
50 PT 2 ; calculates the point for pallet #2 to move to - this will become point #2
60 MO 2 ; move to the new position just calculated
70 SC 22,3 ; move the counter to the next row
80 PT 2 ; calculate a new pallet position
90 MO 2 ; move to the new pallet position

• The example below shows some of the position commands. These positions are normally
defined outside the program by moving the robot to desired locations. These positions are not
always absolute, and in some cases will act as displacement vectors.
page 649

10 PC 1; the clears the position #1 value


20 PD 2, 0, 300, 250, 50, -30 ; define position 2 with cartesian x,y,z and pitch,roll
30 HE 3 ; defines the current robot position as position #3
40 PX 1,2 ; the values of positions #1 and #2 have been swapped
50 PD 4, 0, 20, 0, 0, 0 ; define a new position
60 SF 1, 4 ; this will add #4 to #1 and store it in #1 becoming (0, 320, 250, 50, -30)

• The example below shows some of the counter and branching functions. These tend to use a sta-
tus register approach - for example, a value to be compared will be loaded on one line, the next
line will compare it and a branch instruction will occur on the specified condition. For-next
loops have been constructed as part of this example.

10 SC 1, 2 ; set counter 1 to a value of 2


20 CP 1 ; load counter #1 into the comparison register
30 EQ 10, 100 ; if the value loaded in the last line is 10, jump to line 100
40 IC 1 ; increment the value of counter #1
50 GT 20 ; goto line 20 to continue the loop
100 DC 1 ; decrement the value of counter #1
110 CP 1 ; load counter #1 into the comparison register
120 LT 1, 100 ; if the value loaded in the last line is larger than 1, jump to line 100
150 GS 200 ; goto the subroutine at line 200
160 ED ; end the program
200 RC 10 ; a for-next loop command
210 RC 5 ; a nested loop
220 NX ; this loop will cycle through the loop declared on line 210
230 NX ; this loop will cycle through the loop declared on line 200
240 RT ; return from the subroutine

• The example below shows how to use various gripper and I/O functions. There are eight input
bits and 8 output bits available.
page 650

10 GC ; close the gripper


20 GO ; open the gripper
30 GP 5, 2, 3 ; this defines the gripping force as 5 (N?) and the holding force as 2, there
will be 3/10 of a second delay while the gripper settles
40 GC ; close the gripper using the gripper force
50 OB -7 ; turn off the 7th output bit
60 TB +6, 50 ; if the 6th input bit is on go to line 50
70

39.2.3.4.2 - Command Summary

• A summary of the motion commands is given below,


page 651

DP (decrement position) move to the previous numbered position


DW (draw) Moves the tool from point to point
HE (here) Assigns the current position to a position number
HO (Home) Sets the cartesian reference coordinates
IP (increment position) Move to the next numbered position
MA (move approach) Move from the current position to a new one
MC (move continuous) Execute a continuous motion
MJ (move joint) move a joint by a specified angle
MO move the tool to a specified location
MP Move the hand to a position
MS Move in a straight line
MT moves tool a specified distance
NT return to the global origin
OG move to the cartesian reference coordinates
PA Define a pallet
PC Clear position variables in memory
PD Define a position in memory
PL Copies a position variable to another
PT Calculates a new pallet position
PX Exchange two position variable values
SF Shift the position variable through space
SP Set the robot speed
TI Pause for a set amount of time
TL Define the length of the tool

• A summary of the program control commands is given below,


page 652

CP (compare counter) compare a counter to a value


DC (decrement counter) decrement a counter value
ED (End) End the program
EQ (If equal) Jump if conditions equal
GS (Gosub) Go to a subroutine
GT (Goto) Go to line number
IC (increment counter) Increase a counter value by one
LG (If larger) Branches if larger
NE (If not equal) branch if not equal
NX (Next) Next step in an ‘RC’ loop
RC (Repeat cycle) Repeat a loop the specified number of times
RT (Return) Return from a ‘GS’
SC (Set counter) Set a counter value
SM (If smaller) Branch if the value is smaller

• A summary of the IO commands is given below,

GC (Gripper close) Close the gripper


GF (Gripper flag) Check the gripper status
GO (gripper open) Open the gripper
GP (gripper pressure) Set the maximum pressure while gripper is closing
ID (Input detect) detect the state of an input
IN (Input) inputs parallel data using handshaking
OB (Output bit) Set an output bit
OD (Output direct) Output data to ports
OT (Output) Output parallel data using handshaking
TB (Test bit)
page 653

39.2.3.5 - IBM 7535 Manipulator

• In general
Degrees of freedom 4
Maximum payload 6kg (13.2 lb)
Repeatability (based on constant temp., load, speed) +/-0.05mm (+/- 0.002 in.)
Weight 99kg (218 lb)
Operating Temperature 10C to 40.6C (50F to 106F)
Humidity (based on constant temp. load, speed) 8% to 80%

• Theta 1 axis
motion revolute
Range 0 to 200 degrees +/- 1deg.
Resolution 0.00459 deg.
Low speed (note: this is set by a switch)
max. speed 700 mm/sec (28 in./sec)
max. load 6 kg(13.2 lb)
Medium speed
max. speed 1100 mm/sec (43 in./sec)
max. load 6 kg(13.2 lb)
High speed
max. speed 1450 mm/sec (57 in./sec)
max. load 1 kg(2.2 lb)

• Theta 2 axis
motion revolute
Range 0 to 160 degrees +/- 1deg.
Resolution 0.009 deg.
Low speed (note: this is set by a switch)
max. speed 525 mm/sec (21 in./sec)
max. load 6 kg(13.2 lb)
Medium speed
max. speed 825 mm/sec (32 in./sec)
max. load 6 kg(13.2 lb)
High speed
max. speed 1000 mm/sec (39 in./sec)
max. load 1 kg(2.2 lb)

• Roll axis
motion revolute
Range +/- 180 degrees +/- 1.5 deg.
Holding Torque 35 kg-cm (30.4 in.-lb.)
Maximum load centered on Z-Axis 6 kg (13.2 lb)
Maximum speed 3.7 rad/sec (210 deg./sec. +/-5%)
Rotating Torque 14 kg-cm (12.2 in-lb)
page 654

Max. load inertia 0.1 kg-m**2 (0.074 slug-ft**2)


(Note: effects of off centre loads not
considered, and lower maximum)
Resolution 0.36 deg.

• Z-Axis
motion prismatic
Range 75 mm (2.95 in.)
Maximum Payload 6.0 kg (13.2 lb)
Resolution Not Applicable

• Compressed Air
Maximum Pressure 6 kg/cm**2 (85 psig)
Conditioning Must be moisture free, as through a
moisture separator, and filtered with
regulator.

• The workspace is shown below,

( 0, 650, 0 )
y

x
z

( – 650, 0, 0 )
( 650, 0, 0 )
page 655

7535/7540 LINEAR Rate Values Available

Programmed Rate Arm speed at tool tip Straight line error


mm/sec. (in./sec) mm (in.)

1 60 (2.4) 3.0 (0.12)


2 100 (3.9) 3.7 (0.15)
3 140 (5.5) 4.4 (0.17)
4 180 (7.1) 5.3 (0.21)
5 225 (8.9) 6.2 (0.24)
6 265 (10.4) 6.9 (0.27)
7 305 (12.0) 7.6 (0.30)
8 345 (13.6) 8.4 (0.33)
9 385 (15.2) 9.3 (0.37)
10 430 (16.9) 10.0 (0.39)
20 430 (16.9) 11.5 (0.45)
30 430 (16.9) 11.5 (0.45)
50 430 (16.9) 11.5 (0.45)
0 Exit linear speed and motion

7535 Program Speed Values for PAYLOAD Command

Program speed values Speed of theta1 Speed of theta2 Maximum


at the tool tip at the tool tip payload for speed
mm/sec (in./sec) mm/sec (in./sec) kg (lb)

1 300 (11.8) 225 (8.9) 6 (13.2)


2 500 (19.7) 375 (14.8) 6 (13.2)
3 700 (27.6) 525 (20.7) 6 (13.2)
4 750 (29.5) 575 (22.6) 6 (13.2)
5 900 (35.4) 675 (26.6) 6 (13.2)
6 1000 (39.3) 750 (29.5) 6 (13.2)
7 1100 (43.3) 825 (32.4) 6 (13.2)
8 1200 (47.2) 900 (35.4) 3.5 (7.7)
9 1300 (51.2) 950 (37.4) 2 (4.4)
10 1450 (57.1) 1000 (39.3) 1 (2.2)
0 Default to speed switches
NOTE: Speeds in the table are for planning purposes only and are typical minimum
values. Speed values only consider a single joint moving. Speed at the end
of the arm is greater when multiple joints are used on a single move.
page 656

39.2.3.6 - AML Programs

• All AML comments start with two dashes ‘--’ at any position on a line

• Statements are ended with a semi-colon, and as long as semi-colons are used, more than one
statement can be used on a line.

• Line numbering is done by the AML Editor

• the free form variables/identifiers must: start with a letter; be up to 72 characters in length; use
letters numbers and underscores, except in the last position.

• Statements have the general form,

IDENTIFIER:KEYWORD;
- IDENTIFIER is a unique name that the user has selected
- the colon separates the two elements
- KEYWORD indicates the significance of the IDENTIFIER
to the system
- the semi-colon indicates the end of the statement

• A sample program is given below with comments for explanation,

NEWPROG:SUBR: --A subroutine called NEWPROG to pick up a part


RELEASE; -- open the gripper before dropping to prevent collision
DELAY(20); -- wait 2 seconds to ensure the gripper is open
DOWN; -- drop down to the work surface
DELAY(10); -- wait 1 second just to be sure everything has settled down
GRASP; -- close the gripper
DELAY(10); -- wait 1 second to allow everything to settle down
UP; -- go up so that we can move over other objects
PMOVE(PT(300,300,0)); -- move to 300,300 in robot coordinates
END; -- return to the calling routine

• A summary of the commands is given below,

BRANCH(label); This will force a branch to the statement having the


(flow command) label.
page 657

BREAKPOINT; When this command is executed, it will examine the


(flow command) “stop and Mem” key on the robot. If either is pressed,
the program execution will stop.

DECR(name); Decrement ‘name’ by one.


(logic command)

DELAY(seconds); This commands will wait for the number of tenths of


(flow command) seconds given, this can be used when motions must
finish before continuing. If the value is 10, then the
delay will be 1 second.

DOWN(value); Instructs the robot to drop the gripper (z-axis). The pro-
(motion command) gram delays until the gripper has dropped. If the axis
has not reached it’s limit within the given time, then
an error message will be generated. The timeout can
be altered (from 1.5 seconds) by supplying a ‘value’
argument in tenths of a second. A value of zero
means wait forever

DPMOVE(x,y,z,r); A relative cartesian motion is made in the direction


DPMOVE(x,y,r); specified. if the z-axis has a height control, the z can
(motion command) be included.

GETC(counter_name); The program is halted briefly while the host computer is


(communication command) polled the a new counter value.

GETPART(name); Move to the current part on the pallet.


(pallet command)

GRASP; The EOAT gripper will be closed when this command is


(motion command) issued.
page 658

INCR(name); Variable ‘name’ is incremented by one.


(logic command)

LINEAR(quality); When the robot moves it can follow a number of paths,


(setting command) but this command will set all motions to follow a
straight path. As the ‘value’ goes from 50 to 1 the
path quality improves. If the ‘value’ is zero, the lin-
ear mode is turned off.

NEXTPART(name); move the pallet reference ahead by one.


(pallet command)

PAYLOAD(value); As the mass carried changes, so do the maximum


(setting command) speeds. This command will allow modification of the
motion speeds. As ‘value’ changes from 10 to 1 the
load increases, and the robot will go slower. A
‘value’ of zero will turn the function off.

PMOVE(PT(x,y,r); The PMOVE portion of this nested command will cause


PMOVE(PT(x,y,z,r)); a movement to a point. The PT statement indicated
PMOVE(name); the position of a point. A point ‘name’ could also be
(motion command) used. Here x and y are the cartesian coordinates on
the work plane, and r is the roll of the gripper
(±180°). Home, with the arm stretched to the far left
is (650,0,0)

PREVPART(name); reduce the current pallet part count by one.


(pallet command)

RELEASE; This command is the opposite of GRASP, and will


(motion command) release the gripper.
page 659

SETC(name, value); Set the counter name to a value.


(logic command)

SETPART(name, value); set the pallet name to the given value.


(pallet command)

TESTC(name, value, label); TESTC does a conditional branch statement that com-
TESTI(DIpoint,value,label); pares name to value. TESTI does the same for a DI
TESTP(name,value,label); point, and a value. TESTP compares a pallet name
(logic command) and value. All statements branch to label if the com-
parison is equal.

UP(value); This commands is the reverse of DOWN, as it raises the


(motion command) z-axis.

WAITI(DIpoint,value,time); Pause while waiting for the DI point to reach value.


(logic command) Time specifies a maximum value before an error
message should be generated.

WRITEO(DO point, value); Set DO point to the given value.


(logic command)

ZMOVE(position); Move the z-axis to a given position, if variable position-


ing is available.

ZONE(factor); The accuracy of a point to point move is set using this


(setting command) command. As the value ‘factor’ changes from 15 to 1
the motion times increase, but the final position is
more accurate. If ‘factor’ has a value of zero, the
function is turned off.

• A summary of some of the keywords is,

END; causes a return from a subroutine.


page 660

name:NEW PT(x,y,r); Defines a point name with the values x,y,r and z if the
name:NEW PT(x,y,z,r); robot supports it.

name:NEW ‘string’; A string is assigned to variable name.

name:NEW n; Create a variable name, and assign a numeric value to it.

ident:SUBR; A subroutine called ident is created. A parameter list can


ident:SUBR(parameter); be associated by adding it to the definition.

name:STATIC COUNTER; a counter variable called name is created.

name:STATIC a pallet definition name can be defined. The pallet is


PALLET(ll,lr,ur,ppr,parts); assumed to be rectangular with the three corners
given, ll, lr and ur (lower left, lower right, and upper
right respectively). the parts per row (ppr), and total
number of parts are also given.

label:statement; A label can be arbitrarily inserted before any command


to set a branch point.

39.2.3.7 - ASEA IRB-1000

• In general
maximum payload (for a 200mm tool offset) 6 kg
Maximum moment of inertia 2.5 Nm (dynamic)
Maximum static moment 12 Nm (static)
weight 125 kg
accuracy at wrist +/- 0.20mm

• Axis 1
joint type revolute
range 340 deg.
speed 95 deg/sec
page 661

actuator servo

• Axis 2
joint type revolute
range +/-40 deg.
speed 0.75 m/sec
actuator servo

• Axis 3
joint type revolute
range +/-25 deg. to -40 deg.
speed 1.1 m/s
actuator servo

• Axis 4
joint type revolute
range +/- 90 deg.
speed 115 deg/sec.
actuator servo

• Axis 5
joint type revolute
range +/- 180 deg.
speed 195 deg/sec
actuator servo

• Gripper
Pneumatic 2 solenoid valves are located in the
upper arm, and can be operated by
the programs.
electrical There is a four pole electrical outlet
in the upper arm for use with more
advanced grippers having search
functions.

39.2.4 Unimation Puma (360, 550, 560 Series)

• In general,
- an articulated arm with 3 dof for positioning, and 3 dof for orientation
- left/right arm configurations are possible
- uses DC servo motors for drive
- uses 110-130 VAC, 50-60Hz, 1.5KW
- weight 120 lb
page 662

- repeatability 0.004in
- RS-232C port for dumb terminal
- 32 parallel I/O lines
- memory 16K
- programming language is VAL

• joint 1 (Waist)
joint type revolute
range 315°
max slew rate 1.9 rad/sec.
resolution .0001 rad/bit
maximum static torque 9.9Nm

• joint 2 (Shoulder)
joint type revolute
range 320°
max slew rate 1.8 rad/sec.
resolution .00009 rad/bit
maximum static torque 14.9Nm

• joint 3 (Elbow)
joint type revolute
range 300°
max slew rate 2.6 rad/sec.
resolution .000146 rad/bit
maximum static torque 9.1Nm

• joint 4 (Wrist Rotation)


joint type revolute
range 575°
max slew rate 8.7 rad/sec.
resolution .000181 rad/bit
maximum static torque 1.5Nm

• joint 5 (Wrist Bend)


joint type revolute
range 235°
max slew rate 5.6 rad/sec.
resolution .000199 rad/bit
maximum static torque 1.4Nm

• joint 6 (Flange Rotation)


joint type revolute
range 525°
max slew rate 5.2 rad/sec.
resolution .000247 rad/bit
page 663

maximum static torque 1.1Nm

39.3 ROBOT APPLICATIONS

39.3.1 Overview

• Unlike many machines, robots are easy to imagine performing tasks, because of their similarity
to the human form. This has caused many companies to adopt robots without properly assess-
ing what their strengths and weaknesses are.

• The early days of experimentation lead to many failed applications, as well as some notable suc-
cesses.

• A useful dichotomy is,


Point-to-Point - A robot that typically only has 2 (or very few) possible positions. These
are good for pick and place type operations, and they are often constructed with
pneumatic cylinders.
Manipulation - A robot that assembles, or moves parts requires good end of path motion,
but does not require as much accuracy in the middle of the path. A higher speed
between path endpoints is often desired.
Path Tracking - When arc welding, gluing, etc. the robot must follow a path with high
accuracy, and constant speed. This often results in slower motion, and more
sophisticated control software.
Operating - The robot will be expected to apply forces to perform work at the end of the
tool, such as doing press fits. While the demands for these robots is essentially the
same, they must be capable of handling the higher forces required when in work-
ing contact with the work.
Telerobotics - Acts as a remote extension of human control, often for safety or miniatur-
ization purposes. In these cases the robots often mimic the human form, and pro-
vide some forms of physical feedback.
Services - mail delivery, vacuuming, etc.
Biomedical - prosthetic and orthotic devices.

• The number of degrees of freedom of the robot should be matched to the tasks.

• Note: 5 d.o.f. robots will allow the tool to reach all points in space if the tool has an axis of sym-
metry. For example, a welding torch flame has a symmetrical axis.

• Some commercial applications that have been done with robots are,
- die casting - used for unloading parts from dies, quenching parts, and trimming them
with a trim press. The robot may also be used to put inserts into the die.
page 664

- spot welding - spot welding electrodes are clamped in place, and the weld is made. The
robot allows many welds to be done.
- arc welding- continuous path robots are used to slowly track a path with a continuous
rate, and with control of welding parameters.
- investment casting - robots can be used in the pick and place operations involved in mak-
ing the molds.
- forging- a robot can be used to precisely position the work under the impact hammer,
freeing a worker from the handling hot heavy work pieces.
- press work- the robot handles loading parts into the press, and removing the resulting
work pieces.
- spray painting- a very popular application in which the robot sweeps the paint head
across the surface to deposit a spray. This process has been coupled with electro-
statics to improve efficiency and distribution.
- plastic molding - they can be used for loading the hoppers, and unloading the parts. This
is most effective when the parts are hard to handle.
- foundry process- robots can be used for ladling materials, and preparation of molds.
- machine tools- robots can be used for loading and unloading machine tools, and material
transfer systems.
- heat treatment process - parts can be loaded into the ovens, unloaded from the ovens,
quenched and dried by robots.
- metal deburring - continuous path robots can be used to track rough edges with a compli-
ant tool design.
- palletizing process - parts can be placed in boxes, or on skids in preparation for shipping.
Most robots have program commands to support this.
- brick manufacture - a robot can be used for loading and unloading a kiln, and stacking
bricks for shipping.
- glass manufacture - a robot can handle the breakable glass with a wide EOAT that pre-
vents sagging, etc. The robot can also be used for grinding edges.

39.3.2 Spray Painting and Finishing

• Air spraying - air under pressure causes the paint to atomize and be propelled to the article to be
painted

• Airless spraying - finishing materials, such as paint, are sprayed under considerable hydraulic
pressure through a fixed orifice, which causes the paint to be atomized directly without the
need for air.

• Electrostatic spraying - Atomized particles (paint or powder droplets) are electrostatically


charged. These are attracted to the object being sprayed by the applied electrostatic field. Con-
siderable material savings are achieved since very little of the sprayed material bypasses the
object and is lost. Objects being sprayed are kept at a ground potential to achieve a large elec-
trostatic field.
page 665

• Heating of materials - paint decreases in viscosity when heated and can be sprayed with lower
pressures. Less solvent is required and there is less overspray of paint. Heating may be used
with any of the preceding systems

• Air spraying and electrostatic spraying are the most common methods of application for paints,
enamels, powders, and sound absorbing coatings.

39.3.3 Welding

• These tasks are characterized by the need for,


- smooth motion
- conformity to specified paths
- consistent tool speed

39.3.4 Assembly

• General concepts are,


• one or more robots
• each robot may perform a variety of sub-assemblies
• requires a conveyor and inspection station
• A host computer must synchronize robot actions
• A bad part rejection function should be available
• An organized output should be used, e.g. pallets, or shipping crates.

• These tasks are common, but face stiff competition from fixed automation and manual labor.

39.3.5 Belt Based Material Transfer

• When a robot is used in a workcell, the raw part is delivered in, worked on, and then moved out.
This can be done using moving belts, etc.

• Parts are placed directly on the belt, or placed on pallets first.

• Belts can travel in straight paths, or in curved paths if flexible belt link designs are used.

• If straight belts are used, transfer points can be used at the end to change part/pallet direction
page 666

• When pallets are used, there is a fixture on top designed to hold the part in an accurate position
so that robots and other equipment will be able to locate the part within some tolerance.

• Vision systems may be necessary if part orientation cannot be fixed.

39.4 END OF ARM TOOLING (EOAT)

• The best known universal gripper - the human hand

• Useful classifications are,


- Grippers
- multiple/single
- internal/external
- Tools
- compliant
- contact
- non-contact

• End of arm tooling is typically purchased separately, or custom built.

39.4.1 EOAT Design

• Typical factors to be considered are,


Workpiece to be handled
part dimensions
mass
pre- and post- processing geometry
geometrical tolerances
potential for part damage
Actuators
mechanical
vacuum
magnet
etc.
Power source of EOAT
electrical
pneumatic
hydraulic
mechanical
Range of gripping force
object mass
friction or nested grip
page 667

coefficient of friction between gripper and part


maximum accelerations during motion
Positioning
gripper length
robot accuracy and repeatability
part tolerances
Maintenance
number of cycles required
use of separate wear components
design for maintainability
Environment
temperature
humidity
dirt, corrosives, etc.
Temperature protection
heat shields
longer fingers
separate cooling system
heat resistant materials
Materials
strong, rigid, durable
fatigue strength
cost and ease of fabrication
coefficient of friction
suitable for environment
Other points
interchangeable fingers
design standards
use of mounting plate on robot
gripper flexible enough to accommodate product design change

• The typical design criteria are,


- low weight to allow larger payload, increase accelerations, decrease cycle time
- minimum dimensions set by size of workpiece, and work area clearances
- widest range of parts accommodated using inserts, and adjustable motions
- rigidity to maintain robot accuracy and reduce vibrations
- maximum force applied for safety, and to prevent damage to the work
- power source should be readily available from the robot, or nearby
- maintenance should be easy and fast
- safety dictates that the work shouldn’t drop when the power fails

• Other advanced design points,


- ensure that part centroid is centered close to the robot to reduce inertial effects. Worst
case make sure that it is between the points of contact.
page 668

Part
robot arm

Gripper

Better - less chance of slippage

- holding pressures/forces/etc are hard to control, try to hold parts with features or shapes

robot arm
Part

Gripper

part will be more stable, and well located

- compliance can help guide work into out-of-alignment conditions.


- sensors in the EOAT can check for parts not in the gripper, etc.
- the gripper should tolerate variance in work position with part alignment features
- gripper changers can be used to make a robot multifunctional
- multiple EOAT heads allow one robot to perform many different tasks without an EOAT
change.
- *** Don’t try to mimic human behavior.
- design for quick removal or interchange of tooling by requiring a small number of tools
(wrenches, screwdrivers, etc).
- provide dowels, slots, and other features to lead to fast alignment when changing grip-
pers.
- use the same fasteners when possible.
- eliminate sharp corners/edges to reduce wear on hoses, wires, etc.
- allow enough slack and flexibility in cables for full range of motion.
- use lightweight materials, and drill out frames when possible.
- use hard coatings, or hardened inserts to protect soft gripper materials.
- examine alternatives when designing EOAT.
page 669

- the EOAT should be recognized as a potential bottleneck, and given extra design effort.
- use shear pins, and other devices to protect the more expensive components.
- consider dirt, and use sealed bearings where possible.
- move as much weight away from the tip of the gripper towards the robot.

39.4.2 Gripper Mechanisms

• A gripper is specifically EOAT that uses a mechanical mechanism and actuator to grasp a part
with gripping surfaces (aka fingers)

• Quite often gripper mechanisms can be purchases, and customized fingers attached.

• Fingers are designed to,


1. Physically mate with the part for a good grip
2. Apply enough force to the part to prevent slipping

µ = coeff. of friction between part and gripper


µn f F g = wgS
nf = number of contacting fingers
F g = gripper force
w = weight of part
g = gravity
S = factor of safety
(for basic applications 2 to 3 should be the
absolute minimum, but high speed applications
will require more force to resist inertial forces)

• Movements of the fingers


- pivoting (often uses pivotal linkages)
- linear or translational movement (often uses linear bearings and actuators)

• Typical mechanisms
- linkage actuation
- gear and rack
- cam
- screw
- rope and pulley
- miscellaneous - eg. bladder, diaphragm
page 670

Two Finger Gripper - as the pneu-


matic cylinder is actuated, the
fingers move together and
apart.

Parallel finger actuator - as the


cylinder is actuated, the fin-
gers move together and apart
in parallel.

Two Fingered Pneumatic Actuated - as the cylinder is


actuated, it translates to the fingers opening or clos-
ing. The extra links help increase holding force.
page 671

Two Finger Internal Gripper - as


the cylinder is actuated, the
fingers move outward.

39.4.2.1 - Vacuum grippers

• Suction cups can be used to grip large flat surfaces. The cups are,
- typically made of soft rubber or plastic
- typically round, or oval shapes

• A piston operated vacuum pump (can give a high vacuum), or a venturi valve (simpler) can be
used to generate the vacuum.

• The surfaces should be large, smooth, clean.

• The force of a suction cup depends on the effective area of the vacuum and the difference in the
vacuum, and air pressures.

F = PA F = maximum gripping force


P = difference between vacuum and air pressure
A = total effective area of the vacuum

• e.g.
page 672

We have a suction cup gripper with two 5”diameter cups that is to be used
to lift 1/4” steel plates cut to 2’ by 3’. How much vacuum pressure must
be applied to just hold the plates? Suggest a realistic value.

w = 0.28  ------3- --- ( in ) × 24 ( in ) × 36 ( in ) = 60.48 ( lb )


lb 1
in 4
5 2
A = 2 π  --- = 2 [ 19.63 ( in ) ] = 39.26 ( in )
2 2
2
w 60.48 ( lb )- Minimum to hold plate
P = ---- = -------------------------
2
= 1.54 ( psi )
A 39.26 ( in )
Assume low moving speed for robot, use factor of safety = 2.0

P S = 2.0 × P = 3.08 ( psi )

Note: this is much less than atmospheric pressure (15 psi), there-
fore it is realistic.

• Advantages,
- requires only one surface of a part to grasp
- a uniform pressure can be distributed over some area, instead of concentrated on a point
- the gripper is light weight
- many different types of materials can be used

• Disadvantages,
- the maximum force is limited by the size of the suction cups
- positioning may be somewhat inaccurate
- time may be needed for the vacuum in the cup to build up

39.4.3 Magnetic Grippers

• Can be used with ferrous materials

• Electromagnets,
- easy to control, requires a power supply, and a controller
- polarity can be reversed on the magnet when it is put down to reverse residual magne-
page 673

tism

• Permanent magnets,
- external power is not required
- a mechanism is required to separate parts from the magnet when releasing
- good for environments that are sensitive to sparks

• Advantages,
- variation in part size can be tolerated
- ability to handle metal parts with holes
- pickup times fast
- requires only one surface for gripping
- can pick up the top sheet from a stack

• Disadvantages,
- residual magnetism that remains in the workpiece
- possible side slippage

39.4.3.1 - Adhesive Grippers

• Can handle fabrics and other lightweight materials

• These grippers are basically a sticky surface on the end of the robot

• As the adhesive gripper is repeatedly used, it loses stickiness, but a tape roll can be used to
refresh the sticky surface.

39.4.4 Expanding Grippers

• Some parts have hollow cavities that can be used to advantage when grasping.

• A bladder can be inserted into a part, and then inflated. This forms a friction seal between the
two, and allows manipulation. When done the pressure is released, and the part freed.
page 674

• Expanding grippers can also be used when gripping externally.

bladders inflate inwards

39.4.5 Other Types Of Grippers

• Most grippers for manipulation are sold with mounts so that fingers may be removed, and
replaced.

• Gripper fingers can be designed to reduce problems when grasping.


page 675

Self Aligning Finger Pads - small rock-


ing pads are placed on the end fingers,
these are also covered with a high
friction material, such as rubber.
These allow some locational inaccu-
racy when grasping parts.

Multiple Part Gripper - the gripper


has a number of holes cut for dif-
ferent parts. In this case the grip-
per can hold three different radii,
and the rubber lining will help
hole the part.

39.5 ADVANCED TOPICS

39.5.1 Simulation/Off-line Programming

• How a robot interacts with the environment makes it difficult to program off-line. To do this suc-
cessfully, a complete simulation of the robot workspace is required.

• One excellent example of a simulation package is CIMStation by Silma. It allows full construc-
tion of the robots workspace, and subsequent testing.

• Examples of simulated operation in CIMStation are,


- painting
- NC code verification
- tool and fixture simulation
- Design For Manufacturing
- process planning
- composite tape layup
page 676

- composite filament layup


- spot welding
- arc welding
- material/work manipulation
- collision detection
- deburring
- inspection
- kinematic and dynamic simulation
- controller simulation

• The simulators available for the robots in the lab allow off-line programming and simulations.

39.6 PRACTICE PROBLEMS

1. a) What are some basic functions expected on a robot teach pendant


b) Describe how a computer can help avoid debug robot programs without a robot being used

2. Write a short program to direct a robot to pick up and put down a block. Assume the points
have already been programmed with the teach pendants.
a) Write program for the IBM 7535.
b) Write program for the Seiko RT-3000.
c) Write program for the Mitsubishi RV-M1.

ans. a) NEWPROG:BLOCK;
RELEASE; -- open the gripper
DELAY(5); -- delay 1/2 second to allow the gripper to open
PMOVE(OVER); -- move to the point over the pickup point called ‘OVER’
DOWN; -- move the arm down
DELAY(2); -- wait for the motion to complete and settle
GRASP; -- close the gripper
DELAY(2); -- wait for the gripper to close
UP; -- raise the block
DELAY(20); -- wait for a couple of seconds
DOWN; -- drop the block back to the surface of the table
OPEN; -- open the gripper
UP; move the arm away from the block
END; - terminate the program

3. We plan to use a pneumatic gripper to pick up a 4 by 8 sheet of glass weighing 40 lbs. Suggest
a gripper layout and dimensions of the cups. State any assumptions.
page 677

ans. For stability we want to set up an array of cups. A set of 3 or 4 would be reason-
able to help support the sheet. - I will pick 4. Now, the diameter of the cup should
be determined. We will assume that the vacuum pressure will be 5 psi below
atmosphere, and we will use a factor of safety of 2.

2
FS ( L ) = Nπr P
2
2 ( 40lb ) = 4πr 5psi

--4- = r 2 r > 1.128in


π

4. A vacuum pump to be used in a robot vacuum gripper application is capable of drawing a neg-
ative pressure of 4.0 psi compared to atmospheric. The gripper is to be used for lifting stainless
steel plates, each plate having dimensions of 15” by 35”, and weighing 52 lbs. Determine the
diameter of the suction cups to be used for the gripper if it is decided to use two cups for
greater stability. A factor of safety of 1.5 should be used in the computations.

5. Consider the following gripper design problems.


a) We plan to use a friction gripper to pick up a 50 lb iron plate. Suggest a gripper design and
specify the force required.
b) Design an end effector, and describe the path planning approach for a robot unloading satellites
from the space shuttle.

6. What is the workspace for each of the robots below, and can the robots reach all positions and
orientations in the workspace?

y y y

x x x

y y

x x
page 678

7. Suggest a type of robot suitable for the following tasks. Briefly explain your suggestion.
a) placing pallets on rack shelving
ans. cartesian - well suited to cartesian layout of shelves.
b) electronics assembly
ans. scara - will work on a flat table well.
c) loading and unloading parts from an NC mill
ans. articulated - can easily move around obstructions.

8. Suggest a type of robot suitable for the following tasks. Briefly explain your suggestion.
a) a gas pump robot for placing the gas nozzle into the fuel tank.
b) for drilling holes in a printed circuit board.
c) to vacuum a hotel.

9. Why are 5 axis enough for some robotic applications (eg. welding) and all NC milling opera-
tions?

10. You have been asked to write a program for a robot (you can choose either the Seiko RT-3000
or Mitsubishi RV-M1). The program is to pick up a part at point T1, move to point T2, and then
load the part into a pallet. The robot should then return to point A to pick up then next part. This
should continue until the pallet is full.

T1 = (300, 300, 20)


T2 = (-300, 300, 0)
Pallet has 6 rows and 7 columns
Pallet origin T3 = (300, 0, 0)
Pallet end of row T4 = (350, 0, 0)
Pallet end of column T5 = (300, 60, 0)
page 679

10 T1 = 300. 300. 20. 0. 10 PD 1, 300, 300, 20, 0, 0


ans. 20 T2 = -300. 300. 0. 0. 20 PD 2, -300, 300, 0, 0, 0
30 T3 = 300. 0. 0. 0. 30 PD 30, 300, 0, 0, 0, 0
40 T4 = 350. 0. 0. 0. 40 PD 32, 350, 0, 0, 0, 0
50 T5 = 300. 60. 0. 0. 50 PD 31, 300, 60, 0, 0, 0
60 R = 6 60 PA 3, 7, 6
70 C = 7 70 GO
80 OUTPUT +OG3 80 SC 31, 0
90 DEF PA2(R, C) T3 T4 T5 90 RC 7
100 FOR I = 0 TO R-1 100 SC 32, 0
110 FOR J = 0 TO C-1 110 RC 6
120 MOVE T1 120 PT 3
130 OUTPUT -OG3 200 130 MO 1
140 MOVE T2 140 CG
150 MOVE PA2(J, I) 150 MO 2
160 OUTPUT +OG3 200 160 MO 3
170 NEXT J 170 OG
180 NEXT I 180 IC 32
190 STOP 190 NX
200 IC 31
210 NX

11. An IBM 7535 industrial robot is to be used to unload small 1 lb. cardboard boxes (5” by 4” by
1”) from a conveyor, and stack them in a large cardboard box (20” by 8” and 2” deep). After
the large box is loaded, it will be removed automatically and replaced with an empty one. The
conveyor will be controlled by a robot output, and it will be stopped when an optical sensor
detects a small box. When the box is full the conveyor will be stopped and a light turned on
until an unload button is pushed. The entire system uses a start and stop button combination.
The stop button is not an e-stop, but it will stop the cycle after the small box is placed in the
large box.
a) Layout the position of the conveyor, sensor, large box and robot so that all positions can
be reached. Indicate critical points of objects.
b) Design a robot gripper to pick up the boxes.
c) Develop a flow chart for the robot operations.
d) Write an AML program for the flowchart.
page 680

ans. a)
First, we need to convert the given dimensions to mm.
small boxes = 127x101.6x25.4mm
large boxes = 508x203.2x76.2mm

Next, we need to overlay these on the robot workspace. In this case there is abun-
dant space and can be done by inspection.

( 0, 650, 0 )
y
A
photo
127/2mm sensor x
z
D

( – 650, 0, 0 )
( 650, 0, 0 )

B C
A = (0, 650-101.6/2, 0) = (0, 599.2, 0)
B = (-400, -1.5*127, 0) = (-400, -190.5, 0)
C = (-400 + 101.6, -1.5*127, 0) = (-298.4, -190.5, 0)
D = (-400, 1.5*127, 0) = (-400, 190.5, 0)
page 681

ans. b)

For this application, vacuum grippers should work effectively because the mass is light,
and the boxes should have clean cardboard faces. Because the application has been
designed to lift the boxes in the centers, we should be able to use a single suction cup,
but a large factor of safety will be used to compensate (>= 3). We will assume that we
are using a venturi valve to generate the suction, so a pressure differential of 3psi is rea-
sonable.

( W )FS = PA min
lb
1lb3 = 3 ------2- Amin
in
2
A min = 1in
d min 2
A min ≤ π  ----------
2
d 2
1in ≤ π  ----------
2 min
 2 

d min = 1.13in
Based on this calculation I would select a suction cup that is 1.25” or 1.5” dia.
page 682

ans. c)
Start

reset pallet values

no start
button pushed?
yes

pick up small box

index pallet

move above box


no

no yes
is box full? stop pushed?

yes

turn off conveyor


turn on light

no
reset button?

yes

12. Repeat the previous problem for the Seiko RT-3000 robot.
page 683

ans. a)
First, we need to convert the given dimensions to mm.
small boxes = 127x101.6x25.4mm
large boxes = 508x203.2x76.2mm

Next, we need to overlay these on the robot workspace. In this case there is abun-
dant space and can be done by inspection.

( 0, 500, 0 )
y
A
photo
sensor x

D 127/2mm

( – 500, 0, 0 )

B C

A = (0, 500-101.6/2, 0) = (0, 449.2, 0)


B = (-350, -1.5*127, 0) = (-350, -190.5, 0)
C = (-350 + 101.6, -1.5*127, 0) = (-248.4, -190.5, 0)
D = (-350, 1.5*127, 0) = (-350, 190.5, 0)
page 684

ans. b)

For this application, vacuum grippers should work effectively because the mass is light,
and the boxes should have clean cardboard faces. Because the application has been
designed to lift the boxes in the centers, we should be able to use a single suction cup,
but a large factor of safety will be used to compensate (>= 3). We will assume that we
are using a venturi valve to generate the suction, so a pressure differential of 3psi is rea-
sonable.

( W )FS = PA min
lb
1lb3 = 3 ------2- Amin
in
2
A min = 1in
d min 2
A min ≤ π  ----------
2
d 2
1in ≤ π  ----------
2 min
 2 

d min = 1.13in
Based on this calculation I would select a suction cup that is 1.25” or 1.5” dia.
page 685

ans. c)
Start

reset pallet values

no start
button pushed?
yes

pick up small box

index pallet

move above box


no

no yes
is box full? stop pushed?

yes

turn off conveyor


turn on light

no
reset button?

yes
page 686

ans.
10 R = 3: C = 4: H = 0 ‘ define rows and column variables
20 SPEED 100 ‘ set the robot speed
30 T1 = 0. 449.2 0. 0. ‘ set point A
40 T2 = -350. 449.2 -190.5 0. ‘ set point B
50 T3 = -248.4 449.2 -190.5 0. ‘ set point C
60 T4 = -350. 449.2 190.5 0. ‘ set point D
70 T5 = 0. 0. -50. 0. ‘ a displacement to the conveyor height
80 T6 = 0. 0. -100.4 0. ‘ a displacement to the bottom layer of the large box
90 T7 = 0. 0. -75. 0. ‘ a displacement to the top layer of the large box
100 DEF PA2(4,2) T1 T2 T3 ‘ define pallet
110 WAIT +IE1 ‘ wait for external input #1 to go on, this is the start button
120 FOR H = 0 TO 1 ‘ set box layers
130 FOR I = 0 TO R-1 ‘ loop for rows
140 FOR J = 0 TO C-1 ‘ loop for columns
150 OUTPUT +OE1 ‘ turn on external output #1, this is the conveyor
160 MOVE T1 ‘ move to the conveyor pickup point
170 WAIT +IE2 ‘ wait for the input from the optical sensor to go on
180 OUTPUT -OE1 ‘ turn off the conveyor
190 MOVE T1 + T5 ‘ move to pick up box
200 OUTPUT +OG1 ‘ turn on suction cup on gripper
210 MOVE T1 ‘ pick up the box
220 MOVE PA2(I, J) ‘ move to the pallet position in the large box
230 IF H = 1 THEN GOTO 260 ‘ jump if on the top layer
240 MOVE PA2(I, J) + T6 ‘ move to the bottom layer of the box
250 GOTO 270
260 MOVE PA2(I, J) + T7 ‘ move to the bottom layer of the box
270 OUTPUT -OG1 ‘ turn off the suction cup
280 MOVE PA2(I, J) ‘ move out of box
290 IF NOT IE3 THEN GOTO 310
300 WAIT +IE1 ‘ wait for the start button
310 NEXT J: NEXT I: NEXT H ‘ end of the loops
320 OUTPUT +OE2 ‘ turn on box full light
330 WAIT +IE4 ‘ wait for the reset button
340 GOTO 110 ‘ go back to start anew

13. Given the scenario below, find the minimum angular resolution of the rotating sensor.
page 687

- the robot has +/- 0.5” accuracy


- the pallet can slide +/- 0.1” on the belt

4.8” belt travels

5”
- the driving motor is continuous, and can be run to any angle
- the rotating sensor is an incremental encoder, every rotation of some small angle it issues
a pulse. But, because of the construction of the device, it has a minimum resolution
for angular measurements
- the robot must be able to touch the part to pick it up
- the tool on the end of the robot is a 1” magnet, and it must be able to touch the part com-
pletely to pick it up.
- pulley size is 10” dia.

14. The IBM 7535 robot arm moves its TCP to point (-450, 250)mm at speeds programmed by
‘payload(5)’ and decelerates from the resultant speed to zero in 0.5 seconds. The tool has a
mass of 1.5 kg with its center of gravity at 3cm from the TCP and transfers a mass of 4kg with
its C.G. at 5cm from the TCP.
a) determine the inertia torque about the theta1 axis showing all correct units
b) compare the value in a) with a maximum inertia torque estimated from decelerating a
6kg mass from 1100mm/s to zero in 0.5 sec.
c) Estimate the combined error at the CG of the load due to theta1 and theta 2 resolution

15. Consider a double jointed manipulator as shown below. It is subjected to a loading at the tip of
8 lbs, and works in a heated environment (i.e. T0(room temp.) = 60°F and T1 (working temp.)
= 80°F.
a) Determine the elongation of the manipulator.
b) Determine the total linear deflection of the manipulator.
page 688

c) Determine the total final accuracy of the manipulator of the tip of the manipulator.

50” 10”
cross section is 1” wide by 2” high
solid square aluminum stock

16. For the robot pictured below, assume the that a maximum payload of 10kg is specified. The
joints are controlled by stepper motors with 200 steps per revolution. Each of the joints slides,
and the gearing is such that 1 revolution of the stepper motor will result in 1” of travel. What is
the accuracy of the robot?

maximum 10” Assume the joints are solid, and


to robot links are made from 1”
solid aluminum stock.
maximum 15”

17. Consider a double jointed manipulator as shown below. It is subjected to a loading at the tip of
8 lbs, and works in a heated environment (i.e. T0(room temp.) = 60°F and T1 (working temp.)
= 80°F.
a) Determine the elongation of the manipulator.
b) Determine the total linear deflection of the manipulator.
c) Determine the total final accuracy of the manipulator of the tip of the manipulator.
page 689

50” 10”
cross section is 1” wide by 2” high
solid square aluminum stock
40. ROBOTIC PATH PLANNING METHODS
ABSTRACT:
The main goal in the control of robots is to achieve human flexibility. Unfortunately humans
are very complex systems, and this is carried over to the design of robots. Thus, for any
apparently simple task like motion, there are some very complex control problems. When the
robot must move between two points, it must consider the control of motors, possible collisions,
and physical limitations. These problems have been solved in a number of different ways, and
these solutions tend to follow certain trends. In fact, without generalizations, the number of
solutions is so diverse, that they tend to overwhelm the search for a simple solution. A formal
survey of path planning techniques will allow a knowledgeable overview of path planning.
May 18th,1989.

40.1 INTRODUCTION:
There are a number of different ways to classify the robotics problems. Various features of a
problem may determine which type of path planning strategy will work best. Two fundamental
classifications suggested by Fu, Gonzalez, and Lee [1987, Pg.150] are Obstacle Constraint and
Path Constraint. Obstacle Constraints indicate that there are some points in space which are
already occupied, and are not free for the robot to pass through. Path Constraints are usually
provided as points on a path which the robot must follow. From these two suggestions there is a
control strategy diagram which may be drawn,

Figure 1.1 Control Strategies for Manipulators [Fu,Gonzalez & Lee,1987]


Collision
Avoidance
Yes No
Off-line Collision free Off-line Path
path planning plus, on- Planning, plus on-line
Yes line path tracking. path tracking
Path
Constraints
Positional Control, Positional Control.
plus on-line obstacle
No detection and
avoidance.
page 691

These basic strategies form the basis for most approaches to robotic path planning. Positional
Control is a simple motion controller using joint interpolated motion, or point to point motion.
Path Tracking is moving through a prespecified set of points on a path. All of the strategies in
this diagram affect the methods used to plan paths, thus from this point it is best to discuss some
requirements of the system.

40.1.1 ROBOT APPLICATIONS


Many authors suggest, in their papers, that there are a set of tasks to which a robot may be
applied. The earlier work in Artificial Intelligence suggested many approaches to solving
problems, which involves splitting them into tasks. It is relatively easy to list a few ’commonly
expected’ path planning tasks for a robot.
- Grasping and Releasing objects.
- Moving from place to place.
- Following prespecified paths.
- Following moving objects.
- Working with other manipulators.
- Exerting Forces (i.e.. pushing, pulling and holding).
- Exert Torques.
- Collecting Data.
- Using tools.
Items on this list have been approached by various authors. A paper describing the integrated
approach of all these items is yet to be seen, although some combinations have been documented.
The ideal situation would be a good general method which incorporates all of these features.

40.1.2 ROBOTIC CONSTRAINTS


Robots are machines, and as machines they are subject to all of the constraints of mechanics.
Thus when dealing with many joints (prismatic or revolute) the physical limits of manipulator
motion become evident. For the best solution, the limits of joint and actuator positions, velocity,
acceleration, and jerk must be considered. The physical nature of the device also means that there
are dimensions which must be considered, thus kinematics and collision avoidance come into play.
When a robot makes any move, it expends energy to accelerate, hold and brake. This also means
that the energy efficiency of the manipulator should be optimized, by reducing unnecessary
expenditures of energy. Most importantly, if robots are to be cost effective, then their speed is of
concern. In a high production situation, a cycle time that is 10% faster could save millions of
dollars. Thus, time of path traversal can most often be the most important path planning factor.

MEASURES OF PERFORMANCE:
- Time for Path Traversal.
- Velocity of Manipulator Links or joints.
- Energy.
- Actuator Forces.
page 692

- Proximity to Obstacles.
CONSTRAINTS:
- Joint Positions, Velocities, Accelerations and Jerks.
- Actuator Forces and Dynamics.
- Kinematics (this includes singularities).
- Collisions with Obstacles.
- Time, when moving obstacles are involved.

Considering these factors, the problem may be formulated as a classical optimization problem,
as many authors have done. These approaches usually produce good results, at the expense of
computation time. Other methods are being found which trade off some of the completeness of the
optimization to find solutions quickly.

40.1.3 THE OPTIMIZATION PROBLEM OF PATH PLANNERS


To aid the description of the path planning problem, a generalized statement of the optimization
criteria will be given. This will be presented for both the Measure of Performance and Constraints.
The first most important Measure of Performance is time for the path. To find this, and other
factors, a number of relations will be derived. First assume that the path is made up of a number
of discrete segments (trajectories). These segments are linked together to form the path of motion.
Motion along the path will then have a few characteristics, and these provide the basis for some
equations.

where: si = the ith segment of the path (i = 0 to n), (a vector trajectory)


P = the total path of n linked segments
D = the total path distance
vi = the velocity on the ith segment.
ti = the time to travel the ith path segment.
T = the total path time.
ei = the energy for the ith path segment
E = the total path energy cost (including kinetic, potential, friction).

Local Path Time: ti =˜ si˜ /˜ vi˜

n
Global Path Time: T = S ˜ si˜ /˜ vi˜
i=1

Local Path Length = ˜ si˜

n
Global Path Length: D = S ˜ si˜
i=1

Local Energy Input = ei

n
page 693

Global Energy Input: E = Σ ei


i=1

Feasible is defined as D, P, T, E are all non-infinite.

Local Optimization involves optimizing some function of si, vi & ei.

Global Optimization involves optimizing some function of T, D and E.

Collision avoidance involves altering si so that the path segments avoid obstacles. vi is used to
produce the best velocity through a path segment. ei is a factor which is determined from energy
input, less energy output (including friction loses). One, or any, of si, vi, ei, or n may be altered
when attempting to find an alternate path. These are the only factors describing the path, and they
may be found in various ways by themselves. The other factors involving forces, torques, and
obstacle proximity must be determined in a similar way that is specific to the manipulator.
An example of how to derive, and apply, optimization techniques to an actual system is in
order. To find a value for these parameters for a single link manipulator we would have to define
a few variables
page 694

Figure 1.2 An Example Singe Link Manipulator

Given: T = torque (N.m)


d = mass height (m)
= r/2 sin∅
∅ r
r = arm length (m)
∅ = Angle of arm (rads)
T d ∅′ = Angular Velocity (rad/sec)
∅′0 = Initial Velocity (rad/sec)
∅s = Initial Position (0 rad)
Assume: distributed mass m ∅f = Final Position (π rad)
moment of inertia I
no friction

si = ∅i, vi = ∅′i
ti = ∅i / ∅′i

ei = d/d∅i(Potential + Kinetic + Loses)


= d/d∅i(mgd + .5 I ∅′2 + .5 md′2 + 0)
= .5mgr(sin(∅i+∅) - sin(∅)) + .5I(∅′i2 - ∅′i2) + .25 mr2(cos2∅i - cos2∅i)

Divide path into n segments, ∅i = π / n


Pt = time penalty coefficient
Pe = energy penalty coefficient
n n
Measurement of Performance = Pt(∑ ti) + Pe (∑ ei)
i=1 i=1

This is now a measure of performance for the path described by a set of angular velocities ýi (i =
0 to n). This is a global optimization setup for minimum energy input and minimum time (their
exact weightings are determined by Pt & Pe). We could also express the path by a set of joint
torques using the value ei. This leads to the problem of what do we do with limits on the system.
The limits on a system are a bit more arbitrary. In this case the manipulator may have a
torque limit, and it has a definite position limit. To account for these, equality and inequality
constraints may be used. It is best to use Equality Constraints for the motion limits here, so
that the rotation may get very close, but not touch the ground. If the motion does violate this
constraint, then the function will turn on and make the overall cost very high.

P∅ = Motion Penalty Coefficient


Motion Constraint = 0 (if 0° <= ∅ <=180°)
page 695

= P∅ (if 180° <= ∅ <= 0°)

To compensate for the maximum torque here, an Inequalitry Constraint will be used, so that the
torque avoids approaching the maximum torque value.

PΤ = Torque Penalty Coefficient


n
Torque Constraint = PΤ ∑(ei / Tmax)2
i=1

Every torque value is considered and if the torque approaches a maximum, then the torque con-
straint will grow considerably, and make the overall cost high.
To complete the description the optimization process will be described. The path could be
split into 2 segments (n = 2), the first segment goes from 0° to 90°, the second segment goes
from 90° to 180°. The process is simple, we choose start values for ∅′1 and ∅′2 (these will
both be of the same magnitude, but opposite sign in this example). The next step is to calculate
the value for cost,

COST = Measurement of Performance + Motion Constraint + Torque Constraint

We would continue choosing new values for ∅′1 and ∅′2 until COST has obtained a minimum
value. This would provide an optimal path plan. The next factor of importance is to be able to
express the difference between various path planning methods.

40.1.4 EVALUATION OF PATH PLANNERS


It is valuable to have a number of criteria to determine the value of a path planning method.
These values should reflect the information required, the time (and complexity) of the method, the
type of results, and the level of abstraction from the manipulator.

GENERAL REQUIREMENTS EVALUATION CRITERIA:


- Dimensions of Space (2D, 2.5D, 3D)
- Collision Avoidance (None, Contact Detection, Proximity Calculation)
- Multilink Manipulators
- Rotations of Payload
- Moving Workspace Obstacles
- Multi Robot Coordination
- Degree of Automation
INFORMATION SETUP EVALUATION CRITERIA:
- Information Source (Knowledge Based, Sensor Based)
- World Modelling
METHOD EVALUATION CRITERIA:
page 696

- Path Planning Strategies, for information passing (eg. Hierarchical)


- Path Planning Methods (algorithms used for path planning)
- Internal Representations
- Minimization (Which Costs are minimized?)
- Limits (Which limits are considered?)
- Solution type (Robot, Joint Space, Cartesian Space, Straight Line,
Via Points with Rotations, Splines, etc.)
IMPLEMENTATION EVALUATION CRITERIA:
- Execution (Time, Machine, Language)
- Testing (What are the experimental results?)

Most of these categories are quite basic, but some are not so clearly defined. All of these areas will
be discussed in the subsequent sections.

40.2 GENERAL REQUIREMENTS


The general requirements of a path planner are discussed in this section. Some of the factors
involved in the application, and for evaluating their performance, are described. These factors do
not include all the essential parts of a path planner, nor all of the possible requirements, but they
provide a good idea of what the current requirements are.

40.2.1 PROBLEM DIMENSIONALITY


A problem may be represented in one of a number of different dimensions. The fewer the
dimensions in the problem, the simpler the solution. A 2D problem is relatively simple, and good
solutions already exist for finding paths in this representation. When height is added to the 2D
obstacles, it becomes a 2.5D problem. This 2.5D problem is also within the grasp of current
problem solving routines. When we try a 3D problem the problem starts to push the current limits
of researched techniques and computational ability.
page 697

Figure 2.1 Dimensionality of Obstacles

2D

2.5D 3D

40.2.2 2D MOBILITY PROBLEM


When a simple mobile robot has to navigate across a factory floor, it must solve the classic
’piano movers’ problem. This representation is easily done with convex polygons, and it runs
quickly. This problem is referred to as the piano movers problem, because it involves having to
move a very large object (like a piano) through a cluttered environment, without picking it up. The
perspective is that, the obstacles can be seen from directly above, but they are assumed infinite in
height. This method may be adapted for a robotic manipulator, if it is working in a clear
workspace, and is performing pick and place operations. The use of this method will save time, in
all applicable cases.
As a result of the speed benefit of the 2D path finding solutions, they may be used as analyt-
ical tools. A special property can make the 2D methods applicable to 3D problems. If a 2D
view of a 3D work space shows a path, then the same path will also exist in the 3D workspace.
This has been used in some path planning methods, and can provide a ’trick’ to avoid extensive
3D calculations. Another trick which may be used, is to represent the moving object with a
box or a circle. This result in a simple technique for maintaining a minimum obstacle clear-
ance, for collision avoidance.
page 698

Figure 2.2 Simplification of 3D Problem

3D Space 2D Approximation

40.2.2.1 - 2.5D HEIGHT PROBLEM


When height is added to 2D objects, it is no longer necessary to assume that they have an infinite
height. It is equivalent to changing the view from looking straight down on the workspace to
looking at it from an angle. This can allow some very simple path plans in which the manipulator
is now allowed to move over and around objects. With pick and place tasks this can be the basis
for a method which guarantees that the payload, and manipulator links, are above collision height.
This is a very practical approximation that is similar to the manipulations which humans tend to
favour (i.e. Gravity fed obstacles and objects).
This method is faster than 3D solutions, while still allowing depth in obstacles. Any object
in the real world that does not have a vertical orientation will be very difficult to model.
Despite this problem, this is still a very good representation for solving most pick and place
problems (in an uncluttered workspace).

40.2.2.2 - 3D SPACE PROBLEM


When we have a cluttered 3D space problem, it may not be possible to resort to the use of 2D
and 2.5D representations, if obstacles have irregular surfaces which may not be represented in 2D
or 2.5D. This is the most frustrating problem. This problem has fewer simplifying restrictions,
and as a result the dimensions grow quickly for every new factor.
The most devastating setback to the 3D methods occurs when a multilink manipulator is
added, without any limiting assumptions. The addition of each manipulator link will increase
the problem complexity geometrically. This method may be simplified when spheres are used
to represent moving obstacles.
The most successful attempts at solving this problem have been the optimization attempts.
page 699

Optimization methods are typically slow, and thus the three dimensional path planning prob-
lem will have to be solved off line for now. If a good fast solution is discovered for this prob-
lem, it will eliminate the need for the 2D and 2.5D problems.

40.2.3 COLLISION AVOIDANCE


Collision detection is the most important factor of Path Planning. Without automatic collision
avoidance, the robotic workcell must be engineered to be collision free, or sub-optimal paths must
be chosen by a human programmer. Local Collsion Detection is important when moving through
an unknown, or uncertain environment. These allow for feedback to the planner, for halting paths
which contain collisions. Global Collision Avoidance may be done for planning paths which
should avoid objects by a certain margin of safety. The actual detail of the method may vary, but
moving close to obstacles is avoided by these methods.

Figure 2.3 Collision Avoidance

Goal

No Collision Avoidance

Start Collision

Goal

Local Collision Avoidance

Start Collision

Goal

Global Collision Avoidance

Start

40.2.4 MULTILINK
One problem that tends to paralyse most methods is the expansion to multilink systems. The
first implementation of most techniques is made with a simple mobile robot. When the method is
page 700

increased by adding oddly sized links, and then a payload, the complexity grows at a more than
exponential rate.
The number of degrees of freedom also play in the applications of the robot. If a manipulator
has 6 degrees of freedom, then it can obtain any position or orientation in space. Some specific
cases of problems require only 3 or 4 degrees of freedom. This can be a great time saver.
When an environment becomes cluttered then it may be desirable to have a higher number of
degrees of freedom than six, so that the redundancy of the robot can move through the environ-
ment. The complexity of most routines increases exponentially with the number of degrees of
freedom, thus it is best to match the manipulator degrees of freedom to the complexity of the
task to be done.
One assumption that helps reduce the problem complexity is the approximation of motion in
a single plane. The net result of this effort is that the robot is reduced to 2 or 3 degrees of free-
dom. The payload may also be neglected, or fixed, and thus the degrees of freedom are
reduced. A second approach is to approximate the volume of the links swept out over a small
volume in space. This volume is then checked against obstacles for collisions. A payload on a
manipulator may sometimes be approximated as part of the robot if, it is small, or it is symmet-
rical. This means that the number of degrees of freedom for a manipulator may be reduced,
and thus the problem simplified in some cases.
page 701

Figure 2.4 Multi-Link Approaches

Real Work Space (with payload)

Simple Degree of Freedom Reduction


(this has only 2 d.o.f.)

Approximated Volumes
(of lower arm and payload)

Multilink manipulators also come in a variety of configurations. These configurations lend


themselves to different simplifications, which may sometime provide good fast solutions in
path planning.

- Cartesian (i.e. X, Y, Z motions)


- Cylindrical
- Spherical (Stanford Manipulator)
- Revolute (Like Human arm)
- Scara

The various robot configurations are fundamentally different. Many approaches have tried to
create general solutions for all configurations, or alternate solutions for different specific
manipulators. The fastest solutions are the ones which have been made manipulator specific. With
a manipulator it is also possible to describe motions in both Joint Space (Manipulator Space), and
Cartesian Space (Task Space). There are approaches which use one, or both of these.
page 702

40.2.5 ROTATIONS
Rotations are another problem for some path planners. It can be difficult to rotate during
motion, thus some will not rotate, some will rotate only at certain ’safe’ points, and some will rotate
along a complete path. The best scenario is when rotations may be performed to avoid collisions,
and not just to meet the orientation of the goal state.

Figure 2.5 Payload Rotation

goal

No Rotation

start

goal

Rotations at Points
rotation
point
start

goal

Rotation Along Path

start

40.2.6 OBSTACLE MOTION PROBLEM


Motion of obstacles can cause significant path planning problems. Motion occurs in the form
of rotation, and translation. In most path planners the only motions considered are for the payload
and manipulator. In most cases an obstacle in the environment will experience both rotation and
translation. This has devastating effects on all of the path planning methods, because some tough
page 703

new requirements are added. The path planning systems must now incorporate a time scale factor,
and keep an object description which includes a position, a velocity vector, and rotation vector.
The method must also do the calculations to detect collisions and status at every instant of time as
the system changes. With simplifications the problem may be reduced to a more manageable level.
Obstacles may be categorized into motion categories; Static (un-moving), Deterministic (has
predictable occurrence and positions), and Random (Freely moving, with no regular occurrence).
All of these are of interest because most parts fixed in a workcell are Static, workpieces from
feeders and conveyors are Deterministic, and human intruders are Random. Random obstacle
motion usually occurs so quickly that path planning may only be able to escape the path of the
obstacle, not compensate it. These motion strategies are often considered in the static and cyclic
states, but the Random solutions are not implemented widely, except as safety measures.

Figure 2.6 Obstacle Motion Types

Block on Ground Conveyor Bullet

Static Deterministic Random


(No Motion) (Predictable Motion) (Unpredictable Motion)

40.2.7 ROBOT COORDINATION


If only a single robot may be used in a workcell, then bottlenecks will soon arise. When two
robots are placed in close proximity, they can produce more bottlenecks, thus they must be given
some scheme for avoiding each other. If these robots are to cooperate then a complete and
integrated cooperation strategy is required. These strategies require some sort of status link
between both manipulators. To make sense of the status of the other robot, it is also necessary to
have algorithms for path planning in the Deterministic environment. This algorithm relies upon a
proper moving obstacle path planning scheme being developed first. It is possible to use
assumptions, or an engineered environment to allow robot coordinations, without the
extensiveness of a complete coordination algorithm.
page 704

Figure 2.7 Multi-Robot WorkSpaces

Manipulator #1 Manipulator #2

Transfer
Point

Multi-Robot Work Scheme


(with possible collisions over transfer point)

40.2.8 INTERACTIVE PROGRAMMING


One factor that is now available for all commercial robots is the ability for the human user to
plan the path. This may be done with a special graphical program, or by moving the robot and
setting points, or by entering sets of points. These methods are proven, and do work, but they are
very inefficient, inflexible, and prone to errors. Thus the thrust of this paper will be to ignore the
interactive approach, because automated path planning is much more desirable. The interactive
approach will almost guarantee that an operator will not find an optimal approach. Finding a good
path is not possible without having to stop the robot and lose production time.

40.3 SETUP EVALUATION CRITERIA


The type of environment information required by a path planner is critical to its operation.
Some simple path planners may work in a simple collision detection mode. Some path planners
require pre-processed information about the environment, and they are much more difficult to deal
with.

40.3.1 INFORMATION SOURCE


The sources of information, which a path planner uses, will have a fundamental effect upon
how a path is planned. This is a problem, in how the information is collected. Data may be
collected before or during the execution of a path. This means data may be presented in the form
of an known obstacle (and position), or by a simple indication of contact. These tend to draw
distinctions between methods which have Collision Detection (Local or Trajectory Path Planners)
and those which have obstacle information (Global Path Planners).
page 705

40.3.1.1 - KNOWLEDGE BASED PLANNING (A PRIORI)


It is much easier to solve a problem if all the information is available at the beginning of the
solution. In robotics we may plan paths before their execution, if we have some knowledge of the
environment. This is strictly a ’blindly generate’ type of strategy that trusts the knowledge of the
environment provided. Planning paths before execution allows efforts to get a shorter path time,
more efficient dynamics, and absolute collision avoidance. When working in this mode a priori
knowledge (i.e. Known before) is used. Techniques are available to solve a variety of problems,
when given the a priori information. Some of the knowledge which we use for a priori path
planning may come from vision systems, engineering specifications, or CAD programs.
A Priori Knowledge may be applicable to moving objects, if they have a predictable fre-
quency or motion. A Priori knowledge may not be used for unpredictable or random motion,
there is no detection method allowed by its definition.
A Priori Knowledge may be derived from modelling packages or High Level Sensors. These
sensors are slow and typically drive a World Modeller in an Off-line programmer. The best
example of this type of sensor is the vision systems. This system is the most desired informa-
tion collector for robotics in the future. This system would provide a complete means of world
modelling for the path planner. Another common detection system currently in use is the
Range Imaging System, which use stripes of LASER light to determine geometry of objects.
One example of this is the use of the system to recognize objects and use the geometrical infor-
mation to determine how to grasp the object [K.Rao, G.Medioni, H.Liu, G.A.Bekey, 1989].
Some of these sensors require knowledge from the world modeller for object recognition pur-
poses. In general these sensors are slower because of their need to interpret low level data,
before providing high level descriptions.

Figure 3.1 A Priori Path Planning

Goal Path Manipulator


Planner Controller Motion
State

World
Modeller

40.3.1.2 - SENSOR BASED PLANNING (A POSTIERI)


Sometimes information is not available when we begin to solve a problem, thus we must solve
the problem in stages as the A Postieri information becomes available. Sensor based planning is
an indispensable function when environments change with time, are unknown, or there are
inaccuracies in the robotic equipment. A Postieri Knowledge may be used to find the next
trajectory in a path (by collecting information about the outcome of the previous trajectory) or even
page 706

be used strictly to guide the robot in a random sense when exploring an environment. These
techniques correspond to an execute and evaluate strategy.
This information feedback is acquired through a set of different sensors. The sensors used
may range from vision systems to contact switches. These low level sensors are not very
sophisticated, but their low cost makes them very popular. These sensors will typically detect
various, expected, conditions. Good examples of these sensors are Position Encoders and
Contact Switches. The Sensors can return a signal when contact is made with obstacles, or
measure a force being applied. When used in a feedback loop, they may provide actual joint
position for a position control algorithm. High level sensors also have the ability to provide
low level data, and may be used to detect events. Such Low Level information from this sys-
tem could also be used to check for collisions while in motion, and detect moving objects.
Quite naturally the extent to which this information is collected, determines how the path plan-
ner will work.
The ultimate robot would use these sensors to gather information about the environment, and
then plan paths and verify information during execution. But this raises the point that a mix-
ture of both of the a priori and a postieri methods must be mixed to make a more dynamic plan-
ner. This especially critical when dealing with motion, either to coordinate with regular
motion, or to detect and deal with un-predicted motion. Some good papers have already been
written on path planning in the A Postieri mode.

Figure 3.2 A Postieri Path Planning

Goal Trajectory Manipulator


Planner Controller Motion
State

40.3.2 WORLD MODELLING


How the world is modelled can make a big difference to the path planning strategy. Some of
the assumptions about the world are that all obstacles are solid and rigid. Solid is assumed so that
collisions will occur on contact. Rigid is assumed so that deformations do not occur on contact.
The objects must be represented with some sort of method. Some of the various methods are
Polygons, Polyhedra (constructed with 3D polygons), Ellipsoids, sets of points, analytic surfaces,
Arrays, Oct-trees, Quad-trees, Constructive Solid Geometry (CSG), and Balanced Trees. The
method chosen can limit the use of complex shapes. Some methods are very receptive to data
acquired through sensors and CAD systems.
The most common method of representing objects (in all dimensions) is with convex poly-
gons. These are ideal when working with flat surfaces in the real world. Curved surfaces use
flat polygons to approximate their surfaces. One factor that makes the polygons an excellent
page 707

representation is that if a point is found to lie outside one wall of a polygon, then it may be
declared to be outside the entire polygon. Most methods do not allow for concave polygons,
because they are much more difficult to deal with, in computation. The way to over come this
is to use overlapping convex polygons, to represent a concave polygon. These types of repre-
sentations can typically be derived from most CAD systems. This form allows easy use of
existing facilities.
Arrays are good when fast recall of information from a map is required. The set up time for
an array is long, the memory required is large, and algorithms are slow. This is a more intui-
tive approach, but it is also not very practical with present equipment. Quad-trees (for 2D)
and Oct-trees (for 3D) are excellent representations for the work space. These allow the work-
space resolution to vary, so that empty space in the work cell does not waste space in the repre-
sentation. The disadvantage to these techniques is their complexity can slow down access
times. An enhancement to the Quad-tree and Oct-Tree structures which represent space with
blocks and cubes, is a balanced tree which will use non-square rectangles to represent space.
This could potentially save even more memory than the other methods, but the routines would
again make the access time even slower.
The most powerful method of representation available is CSG (Constructive Solid Geome-
try). This allows objects to be created by performing boolean operations with geometrical
primitives. The original design is done quickly, the object is very space efficient, represents
complex surfaces easily, but it is very quite complicated to use. One method discussed is the
use of bounding boxes for the different levels of an object’s design tree. A discussion was
given by A.P.Ambler [1985] about using Solids Modelling with robotics. The thrust of this
paper was the different operations, communications, and information which a solids modeller
would have to handle to drive a robotic system. This paper proposes a good setup for an Off-
Line Programming Package.
It should be noted that sometimes information is given to the world modeller in an awkward
form. This information may be represented in another way, or interpreted to make sense of the
information. Spatial Planes can be used to establish spatial orientation. Bounding Boxes and
Bounding Polyhedra may be used to approximate complex surfaces so that they may be stored
in a smaller space, and be easy to use by most algorithms.
page 708

Figure 3.3 World Modelling Techniques

2D or 3D WorkSpace Array Quad-Tree

Block =

Remove

Hole =

Balanced-Tree CSG (Constructive Polygons


Solid Geometry)
page 709

Figure 3.4 Modelling Approximation Techniques

Bounding Boxes

Bounding Polyhedra

Separation Planes

40.4 METHOD EVALUATION CRITERIA


The major variation between the path planning methods arises in the approach to the solution.
The methods range from simple mathematical techniques, to very sophisticated multi-component
systems with heuristic rules.
As a result of the numerous approaches to the path planning problem that have arisen, a basic
knowledge is critical to an overview of the field. The best way to start this section is with a
brief definition of strategies, and then a brief explanation of the popular approaches (some spe-
cific methods are detailed in the appendices). Even though the system design strategies are not
a direct part of path planning, they have a profound impact on the operation of the path planner.
page 710

40.4.1 PATH PLANNING STRATEGIES


A path may be planned and executed in a number of different ways. The most obvious is the
direct method of planning a path and then excuting it. This section will attempt to introduce some
of the abstracts behind the strategies of path planners.

40.4.1.1 - BASIC PATH PLANNERS (A PRIORI)


Path planners typically use environmental information, and initial and goal conditions.
Through algorithmic approaches, the path planners suggest a number of intermediate steps
required to move from the initial to the goal state. The path may be described by discrete points,
splines, path segments, etc.. Each of the path segments describe a location (or configuration) and
rotation of the manipulator and payload. These can be furnished in a number of ways, as joint
angles, cartesian locations of joints, location of payload, as a series of relative motions.

40.4.1.2 - HYBRID PATH PLANNERS (A PRIORI)


A newer development is the possibility of hybrid path planning. In this mode a combination
of path planning methods would be used to first find a general path (or set of paths) and then a
second method to optimize the path. This method is more complex, but has the potential for higher
speed, and better results than a single step method.
This strategy may use methods based on alternate representations (like those in figure 3.4).
Some common methods in use are Separation Planes, Bounding Boxes, Bounding Polyhedra,
2D views of 3D workspaces, tight corner heuristics, backup heuristics, etc. These are some of
the techniques that may be used to refine and produce better paths.

Figure 4.1 Basic Operation of a Hybrid Path Planner

goal goal

start start

First Pass (General Path) Second Pass (Optimal Path)

40.4.1.3 - TRAJECTORY PATH PLANNING (A POSTIERI)


The amount of knowledge which a path planner has may be very limited. If the robot has no
previous knowledge of the environment, then information must be gathered while the robot is in
motion. Trajectory planners rely on feedback for finding new trajectories and detecting poor
page 711

results. Contact or distance sensors are used to detect an obstacle and the manipulator trajectory is
altered to avoid collision. This method will typically guarantee a solution (if it exists or if it does
not encounter a blind alley), but at a much higher time cost, and a longer path. The collection of
current data becomes critical when dealing with moving obstacles, that do not have a periodic
cycle. This method may also be tested by simulation as suggested by K.Sun and V.Lumelsky
[1987], who developed a simulator for a sensor based robots.
For the purpose of clarifying this subject a special distinction will be drawn between a path
and a trajectory. When discussing a path, it will refer to the complete route traced from the
start to the goal node. The path is made up of a number of segments and each of these path
segments is continuous (no stop points, or sharp corners). Another name for a path segment
could be a trajectory. This distinction is presented as being significant, by the author, when
considering a trajectory planner, which basically chooses the locally optimum direction, as
opposed to a complete path. Only some path planners use trajectory based planning, which is
easier and faster to compute, but generally produces sub-optimal paths.

40.4.1.4 - HIERARCHICAL PLANNERS (A PRIORI & A POSTIERI)


If the best of both controllers are desired in a single system, it is possible to use a high level
A Priori planner to produce rough paths, and then use a low level A Postieri planner when
executing the path. This would make the planner able to deal with complex situations , and the
ability to deal with the unexpected. This also has the ability to do rough path planning in the A
Priori level, and let the A Postieri level smooth the corners.
page 712

Figure 4.2 A Hierarchical Planner (and an Example)

Goal
State Trajectory Motion
Path Manipulator
Planner Planner Controller

World
Modeller
A Priori Path A Postieri Path

40.4.1.5 - DYNAMIC PLANNERS (A PRIORI & A POSTIERI)


Dynamic Planners are a special mixture of an A Priori Path Planner and A Postieri Motion
controller for a manipulator. The A Priori Path Planner could plan a path with limited or inaccurate
information. If during the execution of this path, a sensor detects a collision, the the A Priori Path
Planner is informed, and it updates its World Model, then finds a new path. To be more formal,
the dynamic Planner is characterized by separate path planning and execution modules, in which
the execution module may give feedback to the planning module. This is definitely a preferred path
planner for truly intelligent robotic systems. Some dynamic planners have been suggested which
would allow motion on a path, while the path is still being planned, to overcome the path planning
bottle neck of computation time.
page 713

Figure 4.3 Dynamic Path Planning

Goal Path Manipulator


Planner Controller Motion
State

World
Modeller

40.4.1.6 - OFF-LINE PROGRAMMING


One strategy that has become popular is the Off-Line Programmming approach. When using
Off-Line Programming we will take an environmental model, which allows human interaction and
graphical simulation to model the robot. Via the tools, the human may produce optimal paths in a
combination of human intelligence and algorithmic tools. This is best compared to a CAD package
that allows modelling of the robot and the work cell. Once the modelling has been completed, a
various assortment of tools are available to plan manipulator motions inside the workcell. This
allows rearrangements of obstacles in the workcell, and optimization of robot motions and layout.
This sort of software package may be used in a number of modes. The Off-Line Program may
interactively calculate, and download, a path which directly drives the robot. The Off-Line
Program may also create a path for the manipulator, which includes programming like directions
(J.C.Latombe, C.Laugier, J.M.Lefebvre, E.Mazer [1985]). In the Off-line programming mode the
results are usually slower, in the order of minutes for near optimal path generation. This time is
acceptable when doing batch work, and setups for large production runs. If the Off-line program
cannot find an optimal path before the previous tasks have completed, the workcell will have to
halt. The most important aspects of the Off-line programmer is the World Modeller and Graphical
Interface.
An Off-line programmer was discussed by A.Liegeois, P.Borrel, E.Dombre [1985]. The
authors approach was to use a CAD based approach with graphical representation and collision
detection, then convert the results to actual cartesian or joint coordinates.
At present Off-Line programmers are possible, and there are many good graphical and path
planning methods available in construction of these packages.

40.4.1.7 - ON-LINE PROGRAMMING


The previous Off-line Programming method allowed a mix of human interaction and A Priori
path planning in a modelled environment. The same concept is possible, with human interaction
and the A Postieri path planning. This is On-Line programming, because there are no graphical
simulations in this strategy, the actual robot is used. On line programming allows the user to
page 714

directly enter robot motions and directly verify their safety and use tools to optimize the path. This
is not desirable for path planning because it is time consuming and inflexible, this is similar to the
original method of robot programming with set via points.

40.4.2 PATH PLANNING METHODS


This section will attempt to provide a simple point of view, to classify the path planning
techniques available. It should be noted that all of the methods are trying to optimize some feature
of the path, but they do not all use classical Optimization Techniques.
The most complete approach to path planning is Optimization. Optimization techniques may
be done on a local and global basis. Through the calculation of costs, constraints, and applica-
tion of optimization techniques, an optimal solution may be determined. Some of the mathe-
matical methods used for the optimization technique are Calculus ofVariations, Trajectory
optimization (hit or miss shoot for the goal state) and dynamic programming. The most notica-
ble difference between Local and Global optimization is that Local optimization is concerned
with avoiding collisions (it will come very close), and global optimization will avoid objects
(make a wide path around, when possible).
The most intuitive approach is the Spatial Relationships between Robot and Obstacles.
This approach uses direct examination of the actual orientations to find distances and free
paths which may be traversed. It was suggested by Lozano-Perez (1983) that spatial planning
"involves placing an object among other objects or moving it without colliding with nearby
objects". There are quite a few methods already in existence.
The Transformed Space solutions are often based on Spatial Planning problems, they are
actually attempts to reduce the complexity of the spatial planning problems by fixing the orien-
tations of objects. These problems diverge quickly from spatial planning when they use tran-
formed maps of space. When space is transformed, it is usually mapped so as to negate the
geometry of a manipulator. The best known approach is the Cartesian Configuration Space
Approach as discussed by Lozano-Perez [1983]. These techniques have different approaches
to representing the environment, but in effect are only interested in avoiding objects, by gener-
ating a mapped representation of ’free space’ and then determining free paths with a FindPath
algorithm.
An alternative to the previous methods are the Field methods. These methods impose some
distributed values over space. The Potential Field method is a technique similar to Spatial
Planning representations. This involves representing the environment as potential sources and
sinks and then following the potential gradient. This technique is slow and tends to get caught
in Cul-de-sacs. The Gradient method is very similar to the Potential field method. It uses
distance functions to represent the proximity of the next best point. This method is faster than
the Potential field method, and it gets caught in Cul-de-sacs.
An approach which is beginning to gain popularity is the use of Controls Theory for path
planning. This was done, very sucessfully, by E.Freund and H.Hoyer [1988]. This approach
allows the non-linear control of a robot, which includes the collision avoidance for many mov-
ing objects, mobile robots, manipulator arms, and objects that may have a variable size. This
approach seems to have great potential for use in low level control, in the A Postieri sense.
To be complete, there are some techniques that are uncommon (like path planning with sim-
ulated anealing S.Kirkpatrick, C.D.Gelatt, M.P.Vecchi [1983]), or are still in their infancy (like
page 715

the controls approaches). To cover these there will have to be a New and Advanced Topics
classification. This does not indicate a shortcoming in the representations, but a lack of defini-
tion in the areas included.

40.4.3 OPTIMIZATION TECHNIQUES

40.4.3.1 - SPATIAL PLANNING

40.4.3.2 - TRANSFORMED SPACE

40.4.3.3 - FIELD METHODS

40.4.3.4 - NEW AND ADVANCED TOPICS

40.4.4 INTERNAL REPRESENTATIONS


Most problem solving techniques need some internal method of dealing with the problem.
These methods all have their various advantages. Most of these internal representations depend
upon the method of world modelling used in the setup. These may be converted inside the
program. There are factors to consider when choosing between various internal representations.
For example if arrays are used they are very large and, the updating procedure is very slow, but
the lookup is very swift. This technique is of best use when, the obstacles do not move, and the
arrays are set up off-line to be used on line. With the current advances in computer hardware (i.e..
Vector Processing and Memory) special hardware may become available that will make the arrays
based methods very fast, thus they should not be discarded, but shelved.
The next technique of interest is lists. These are mainly an efficient way to store linked data.
This may vary from an oct-tree representation of some object to a simple list of boxes in space.
These are efficient with space, but there is storage overhead, and lookups are slower than the
array.
Functions are very space efficient, but they are subject to inflexibility. Functions may repre-
sent a variety of execution speeds from quite fast for a simple problem to very slow for a com-
plex problem. It should be noted that functions may grow exponentially with increased
environment complexity. This function should be used with discretion.
page 716

40.4.5 MINIMIZATION OF PATH COSTS


Each path has some features which affect the cost. As was described earlier the costs are time,
velocity, dynamics, energy, and proximity to obstacles. A basic statement of the goal is given, and
this should be used when formulating a complete Measure of Performance function or algorithm.

"The manipulator should traverse the path in the least amount of time, with reasonable forces on
the manipulator, using a reasonable amount of energy, and not approachnig obstacles too
closely."

40.4.6 LIMITATIONS IN PATH PLANNING


The constraints in Path Planning were also described earlier. These also evoke a single
statement in description,

"The Kinematic, Dynamic and Actuator constraints of the manipulator should not be exceeded,
and obstacles should not be touched."

This is worded arbitrarily, because of the variations in different manipulators. If this statement is
followed in essence, then the limits will be observed. Consideration of this statement will aid
when creating a Constraint function or algorithm for a robot path planner.

40.4.7 RESULTS FROM PATH PLANNERS


The results from path planners tend to come in one of a number of simple forms. The actual
numbers may represent joint or cartesian locations. These may be used in various ways to describe
a path; Splines, Functions, Locations, Trajectories, and Forces. This area is not of great importance
because the problems have been researched, and it is easy to convert between the path planner
results. The only relevence of this area is that results are ussually expressed in a form preferred by
the path planning method.

40.5 IMPLEMENTATION EVALUATION CRITERIA


This section is the most difficult to handle. In some cases the methods are excellent, but the
implementations are so poor that they fail to display the merits of a path planning method. Up to
now researchers have occasionally included run-times and machines, for their discussions,
although some have not tested their methods. This variation is noticable, thus some standardization
is needed. In this section some simple means for comparison are suggested. A quick list of general
implementation evaluation criteria is also in order,

- minimum time for solution search


- minimum path time
- maximum forces
- minimum distance
page 717

- maximum torques
- 2D mobile robots or 3D linked manipulators
- feasible trajectories

40.5.1 COMPUTATIONAL TIME


One thing that needs definition is the Typical Execution Time. The problem with this criterion is
computers, languages and programs run at different speeds, and various problems will vary
between implementations. Thus the author proposes a set of two scenarios in 2D and 3D
workspaces, and suggests that Typical Execution time be expressed in machine cycles (A good
High Level Robotics programmming Language could save a lot of trouble at this point).

Figure 5.1 Path Planning Test Scenarios

2D
2.5D or 3D

These look like nicely packaged problems, but they call for a few exceptions. The classic "Piano
Movers Problem" is a good example. The piano movers problem is perfectly suited to a mobile
robot. If the routine is used for mobile robots, then both the scenarios above should be used on the
object to be moved (without the arm). In both of these problems the consideration of manipulator
links is important. In a 3D problem the path planner must consider all links of the robot as linked
objects which are to be moved, without collision. The ideal minimum, to properly evaluate the
methods on a comparative basis, would need planning time, setup time, travel time, and a
performance index (covering stress and strain in the robotic manipulator).
These tests have one bias, both are oriented towards representation with polygons. This was
considered acceptable because most objects in the real world are constructed of flat surfaces,
or can be approximated with them (like Cylinders, Spheres, Toroids).
The ultimate path planning test could be a needle through a hole problem. In this scenario, a
box with a hole in it could be held at an odd angle in space. The peg could be picked up off the
page 718

ground, and inserted into the hole. The manipulator could then force the peg through the hole
as far as possible, and then remove the peg from the other side and return it to its original posi-
tion. This could also be approached as a single path, or as many as twelve separate paths.

1. Move arm near cylinder


2. Move to and grasp cylinder
3. Move to near hole
4. Insert peg in hole and release.
5. Move arm away from peg.
6. Move arm to near other side of peg.
7. Grasp peg.
8. Remove peg from hole.
9. move peg to near original position.
10. place peg on ground and release.
11. move away from peg.
12. Move arm to start position.

This evokes a number of different approaches. The most obvious is the use of both gross and fine
motions. The second most obvious is a single path in which all of the tasks are located at via points
on the path. Another approach is to combine steps into more efficient tasks. This problem allows
flexibility for all path planners.

Figure 5.2 Peg Through Hole Problem

Use manipulator to Move Peg Through


Hole and then Return it.
page 719

40.5.2 TESTING OF PATH PLANNERS


Testing a new method is very subjective problem. The points to consider are the type of
method used, and its implementation. A few points by which to describe these methods are given
below, but these facts are not always given in the path planning papers.

- Guarantee to find solution.


- Optimality of Solution.
- Ability for method to get trapped.
- Ability to find alternate paths.
- Degree of Automation in the Planning process.

40.6 OTHER AREAS OF INTEREST


Some areas do not fit into the standard criteria for evaluation. These are just as important, but
have not been needed, or heavily researched yet. This section is intended as a catch-all for the
intangeable, or so far in-formal, factors in Path Planning.

40.6.1 ERRORS
Errors are inherent in every sort of system. Robotics is no exception, but in robotics errors
can be very costly and dangerous. Thus there is a definite need to deal with error trapping, error
reduction, error recovery, error simulation, and error prediction. All of these errors can arise in any
part of the system, and in the domain of path planning they can have a drastic effect. An error in
world modelling can result in a faulty path that may be less than optimal, or at worst cause a
collision. In a feedback system, the errors could indicate fictitious collisions, or empty space when
it is actually occupied. Thus all aspects of robotic path planning should eventually encorporate the
ability to deal with unexpected events, and eliminate errors.

40.6.2 RESOLUTION OF ENVIRONMENT REPRESENTAION


For some planning methods this is not applicable, but for other methods this becomes a critical
factor. The real resolution of the environment is governed by accuracy and repeatability. The
accuracy is the variance between the commanded and actual manipulator position. Repeatability
is the variation in position that occurs when a position in space is re-found by the manipulator.
Both of these factors are subject to possible errors which arise from sensor data. These errors can
add a compounded error into the robot system, and thus they should be introduced into the path
planning routines. Neither of these methods is considered by many of the authors of papers.
The resolution will have the most profound impact when the environment is represented in an
array, oct-tree, Quad-tree, integers, or via sensors. Thus good research into resolution for a
robotic system will allow auto scaling of Path Planning methods to be used, to match the envi-
ronment, and provide realistic accuracies. One benefit of this approach would be running
methods quickly at a poor resolution, for fast solutions, and at a high resolution for accurate
solutions, in tight corners.
It was suggested by J.H.Graham [1984] that probabilistic methods for path planning help by
page 720

allowing looser tolerances of parts involved, and allowing motions not normally considered.
To help overcome the resolution problem there are a couple of tricks. When modelling in
three dimensions the surfaces may be multifaceted, and hard to calculate quickly. This aspect
of calculation may be sped up by using simple approximating surfaces not near the start or stop
point, where low resolution is acceptable. It is also possible to use gross motionapproxima-
tions when travelling through this space. Finally, if the path planner uses collision avoidance,
errors in accuracy will be insignifigant, because the avoidance of objects may be greater than
the resolution..

40.7 COMPARISONS
Now that the various methods and techniques have been introduced it is possible to discuss them
in a general sense. A chart format has been chosen to present some of the known information. The
information may be spotty in some cases where researches have not provided complete data. Also,
because a chart is a rigid structure to present information of this sort, a small section is included
with comments. This table should only be used as an overview, it is not complete, and it is very
general.
page 721

Figure 7.1a A Comparative Chart of Path Planning Methods


Machine Solution
Method Space & Time Rotation Setup Optimize Type Comments Multilink
Cartesian 2D PL/1 not conv Distan searc Goo Not
Configuration & 3D on inherent ex ce h of d for 2D imple
Space IBM370/ polygon obstacle mobile mente
(Lozano- 16 time s corners robots d
Perez, 1979) unknown
2D inher Distan Searc Only
Generalized not ent Conv ces and h of good for no
Cones given ex avoidanc midpoin 2D
(Brooks, Polygon e ts mobility
1983) s between .
2D obstacle
inher s yes.
2 to 5 ent time good
Joint minute Conv Searc for
Configuration setup, 15 ex h of planar
Space second Polygon joint motion.
(Red, et.al., 3D solution s and Configu
1985) on VAX robot. ration No
11/780 not avoida Space
inherent nce Exce
3D VAX llent for
Spatial 11/750 1 Work Searc 3D yes
Planning Vision to 20 cell h of mobile
Based seconds inher views veloci Oct- robot
(Wong, et al, 2D ent ties, Trees
1986) minut avoidanc off- yes,
es on unkn e and line but
Velocity microVA own joint Opti program link
Optimization X inher limits mize package collisi
(Dubowsky 2.5 ent time path availabl ons
et al, 1986) D splines e ignore
minut conv mid- d
e on ex research
Time VAX 11/ polygon Opti results yes
Collision 750 verti s and avoida mize
page 722

Figure 7.1b A Comparative Chart of Path Planning Methods


Machine Solution
Method Space & Time Rotation Setup Optimize Type Comments Multilink
Oct-Tree 3D Perkin yes Solid Distan Searc Has Yes
(Faverjon, -Elmer Primitiv ce & h of Potentia
1986) under 1 es from Avoidanc Oct- l in CIM
minute custom e Tree System
CAD
2D yes No
Potential or 3D SUN Poly This
Field 260, 10’s gons or Avoid 3 is slow,
(Y.K.Hwang, of Polyhed ance & Findpat but it
N.Ahuja, 1988) minutes ra Distance h produce
yes routines d some Yes
2.5 in good
Configuarati D VAX Potentia paths.

40.8 CONCLUSIONS
This is the most interesting section, but unfortunately, very vague. In the next few years
Powerful computer hardware advances will allow low cost, but extremely powerful operations.
This will make many memory intensive path planning methods feasible, the very complex
operations will now be reasonable for calculation. If computers become powerful enough, then an
expert path planning system would be a definite asset, making the robots flexible over a number of
different frontiers, without any programming. The advance of customized computer hardware
which now does graphics indicates that it is very feasible to convert complex robotic path planning
from a software to a hardware domain. The potential of parallel processing also opens doors to
solving very complex and involved problems.
A good direction for robotics research is to allow a path planning system which will combine
the various problems and solutions. This will allow the robot to switch modes with an expert
system and thus chose the solution to fit the problem, and not try to make the problem fit the
solution, as is commonly done now. This would involve the use of rules and heuristics (based
on the elements discussed in this paper) to build up a very complex and complete path planner
from very simple methods (which are currently being researched). The multi-level path plan-
ning strategies are seen to also hold promise for robotic development (the author prefers the
Dynamics Path Planning approach). These approaches allow the best of all planning methods.

40.9 APPENDIX A - OPTIMIZATION TECHNIQUES


Optimization involves modelling a system as a function of some variables, then deriving some
cost, or measurement of performance from it. The variables are then adjusted to get the best
measure of performance out. These methods give the best results, but they can be tricky to set up,
page 723

and they can be very slow.

40.9.1 OPTIMIZATION : VELOCITY


By optimizing the manipulator velocity the path time can be reduced, and the robot used to its
full ability. One approach was made by S.Dubowsky, M.A. Norris and Z.Shiller [1986]. The
thrust of their research was production of a Path Planning CAD System called OPTARM II. Their
program will produce a path which is made up of smooth splines. The optimization is done to keep
either the maximum or minimum torque on the robot actuators. Their success was in producing
path within 5% of optimal value based on collision avoidance and motion limits on the joints. For
a six degree of freedom manipulator the program produces smooth motion on the microVAX in a
few minutes of CPU time, which will give optimal paths up to twice as fast as the constant velocity
method for path motion.
A different approach to the velocity optimization problem was taken by B.Faverjon and
P.Tournassoud [1987]. A fast method was found for finding distances of separation between
objects in space. The world was modelled as geometrical primitives, and the primitives could
be used to represent the world to various depths of complexity.

Figure A.1 Various Levels of Geometrical Representation

Using the distance of separation in a function for a velocity damper, the collisions were incorpo-
rated as a constraint. When the cost function was optimized for velocity the tendency was to
avoid obstacles where velocity was damped. This method was also made to work with moving
objects.
This method was intended for use with a 10 link nuclear manipulator, and it has been imple-
mented on a SUN 3 computer. The actual run time was not given, but the routine ran at a tenth
of the speed possible with the manipulator. The manipulator was said to have approached
objects to within 1 cm.

40.9.2 OPTIMIZATION : GEOMETRICAL


A different approach based on the calculus of variations has been developed by R.O.Buchal
and D.B.Cherchas [1989]. The techniques use convex polygons to represent objects, and an
iterative technique to find the best path which avoids these polygons. The path is subdivided into
page 724

a number of smaller intervals, linking a set of pre specified via points. Convex hulls are used to
represent the volume swept out by the motion of the moving object. The penetration depth, and
penetration vector, are used to correct the path for each of the individual path segments.

Figure A.2 Path Segment Interference

obstacle

Approximating
Convex Hull

The penalty function is formulated as to consider the limits on the joints and actuators. The opti-
mization routine is used to correct the path segments, and this procedure takes about 1 minute
on a VAX 11/750 for a 2D model, with manipulator considered, without manipulator colli-
sions. The main objective of this routine is to minimize time. This method needs a set of path
points specified for good solutions, and this is a potential area of research.

40.9.3 OPTIMIZATION : PATH REFINEMENT


Some methods provide very rough paths containing jerky motions. To smooth the jerks in
paths (as a post processor), a method was suggested by S.Singh and M.C.Leu [1987]. Using the
technique of Dynamic Programming, time and energy for a given path are minimized. This method
does not account for collisions, but is intended to just be run Off-line. A control strategy is
suggested for the manipulator to use on the resulting path. Even though the performance of this
method is not given, it looks like a good addition to any a priori programming strategy.

40.9.4 OPTIMIZATION : MOVING OBSTACLES


Every environment has something moving. To consider this problem B.H.Lee and Y.P.Chien
[1987] suggest a method for off-line optimization of this problem. Unfortunately this method was
not implemented, thus the success of the technique is unknown. The first constraint is a maximum
time for motion, this is to force movement before iminent collision and also to force speed in the
path. A constraint is assigned to the priority of the obstacle, which usually has first priority on the
path. The constraints of start and stop points are also used. Collision constraints are also used,
page 725

with every object represented as a sphere. The Cost function considers smoothness of the path, and
the torque of the actuators, to ensure that the robot is not overstretched.

40.9.5 OPTIMIZATION : SENSOR BASED


An interesting approach to path planning was suggested by B.Espiau and R.Boulic [1986]. In
the attempt to find a path planning method for a 10 degree of freedom manipulator, they came up
with an unusual approach to optimization. With proximity or contact sensors mounted on every
link of the manipulator, the path was navigated. To do this the sensor data would be used alter the
penalty functions to represent detected obstacles encountered by the manipulator. The cost
function was based on velocity and dynamic functions. This gave a dynamic approach to finding
paths in which the path was found by the local optimization of trajectories. For this particular
method a large number of sensors are required, and unfortunately the authors did not provide
statistics about the performance of the method.

40.9.6 OPTIMIZATION : ENERGY


In a method suggested by M.Vukobratovic and M.Kircanski [1982] the energy of the system
was proposed as an excellent method for path planning. Using the techniques of optimization for
energy the best path is found. This is done by calculating the dynamics at certain points in space,
and then using the dynamic programming technique (of operations research) to find the best path.
This technique runs a few minutes on a PDP11/70. The end effector is ignored in this method as
negligible. This method is only intended to smooth paths, so that the stresses on the load and
manipulator are decreased. The information provided on this method was not very complete.

40.10 APPENDIX B - SPATIAL PLANNING


Spatial Planning is best described as making maps of space, then using the direct relationships
between those objects in space to find paths. These methods cover a variety of techniques, but
essentially their primary funtion is to determine the spatial relations between the object and the
obstacle and avoid collisions. These techniques in general have not produced the best paths, but
they produce paths quickly. These methods are also best used with 2D problems.

40.10.1 SPATIAL PLANNING : SWEPT VOLUME


Lozano-Perez and Wesley (1979) discuss a generate and test strategy used for path planning.
The technique will begin with a straight line from start to goal, regardless of collisions. Then a
repetitive cycle of analysing a path (by detecting collisions on the path with Swept Volumes) and
then using the information to generate an improved path.
This method may be more formally described with a set of steps. The first step is to check the
validity of the proposed path. The path validity is found by considering volume swept out as
the object moves along the path. If a collision is not detected the method will be halted. In the
case of collision, the information about the collision will be used for correction of path. This
page 726

information used may include details about the collision, like shape of intersections of vol-
umes, the object causing collision, depth of penetration, and the nearest free point.
The difficulties of this solution become obvious when some of the intricacies of the problem
are considered. Models of complex surfaces can contain a very large number of simple sur-
faces. Calculating the intersections of these numerous simple surfaces can be a very difficult
task. A second problem is how we may determine a global optimum when only local informa-
tion about obstacles at collisions is made available. With the local information about collisions
being used in path correction, radical different options are ignored. These two problems could
result in an expensive search of the space of possible paths with a very large upper bound on
the worst case path length.

Figure B.1 Swept Volume Path Planning

G G

Swept
S S Volume

Initial problem First Iteration

G G

S S

Second Iteration Third and last Iteration

40.10.2 SPATIAL PLANNING : OPTIMIZATION


Lozano-Perez and Wesley [1979] describe their work (see Cartesian Configuration Space) as
being an improvement over the Optimization Technique of Spatial Planning. The basic concept
page 727

they describe, is to explicitly compute the collision constraints on the position of a moving object
relative to other obstacles. The trajectory picked is the shortest path which will satisfy all of the
path constraints.
With objects modelled as convex polyhedra, vertices of the moving object may move between
the obstacle surface planes and collide. This condition is easy to detect, because if a vertices is
outside any plane of an obstacle, there is no collision. One possible simplification is to use a
circle to represent the objects geometry, and just maintain a radial clearance from all objects. It
should also be noted that the circular geometry is not sensitive to rotation. This was the path
planning technique used in a mobile vehicular robot called SHAKEY by N.J.Nilsson [1969].

Figure B.2 Spatial Planning - Optimization

40.10.3 SPATIAL PLANNING : GENERALIZED CONES


Generalized cones [R.A.Brooks, 1983] are a faster approach than the Cartesian Configuration
Space method . These cones are achieved through a special representation of the environment. The
surfaces of convex polygons are used to determine conically bounded pathways, for the path of the
object being moved. The method of determining free pathways (or Freeways) is based on the use
of cone shaped spaces. The cones fit snugly between objects and have spines that run along the
centre of the cones. These spines are the paths that the object may travel along. This makes the
method inherently 2D and thus has not been implemented in 3D as of yet, but it has spawned a
method which is successful in 3D by Brooks[1983]. To determine which spines to follow, the
author uses the A* search technique to explore the various paths along the spines. This leads to
problems in cluttered spaces where certain possible paths may be overlooked by the generalized
cones. This method chooses a path with considerable clearance of objects.
page 728

Figure B.3 Problem Represented with Generalized Cones

cone

spine

Figure B.4 Problem Represented with Generalized Cones


Goal

Start

As can be seen the rotation with this technique is very restricted, and the object is typically ori-
ented with the spine.

40.10.4 SPATIAL PLANNING : FREEWAYS


A follow up to R.A.Brooks [1983] research into the use of Generalized cones for the
representation of Free Space, R.A. Brooks [1983] developed a method of path planning for
manipulators with 5 or 6 d.o.f. motion. This method is able to solve the pick and place problem in
under a minute on an MIT Lisp machine, by approximating the robot as a 4 d.o.f. manipulator. His
method is based on the assumption that the world is represented as supported, and suspended,
page 729

prisms. This method is suggested as a possible precursor for the use of video information about
the workcell, from a high level vision system. This has two points of interest; the objects which
are suspended from the side will be grossly misrepresented, but this form of encription suits video
cameras well. The assumption that the manipulator may be treated as a set of 4 d.o.f. is based on
the limitation of the problem to only pick and place operations and insertion (or fitting) operations.
This unfortunately means that the objects may only be rotated about the vertical axis when in
motion.
The use of Freeways between obstacles allows a choice between alternate paths.

Figure B.5 Freeway Between Blocks

The freeways are basis for maps of joint configurations which are acceptable for motion through
these freeways. The methods then find the path using link constraints. This method is
described in algorithm form, and the algorithms are quite substantial.

40.10.5 SPATIAL PLANNING : OCT-TREE


In a paper by T.Soetadji [1986] a method for 3D path planning by a mobile robot is suggested.
The method is based upon use of an Oct-tree representation of 3D space. In the paper, the
development of the Oct-Tree routines is discussed, and a robotic system for implementation is
suggested. Once the Oct-tree is set up, an A* or a Breadth First search is used to find the best path
for the mobile robot. This method finds the minimum distance (with collision avoidance) on a
VAX 750. The search time for the path is on the order of 1 second. The tree structure also proves
very efficient, because it had only occupied 1.7 MBytes of memory for a very complicated
environment.
page 730

40.10.6 SPATIAL PLANNING : VORONOI DIAGRAMS


A newer approach to representing space has been done with Voronoi Diagrams. O.Takahashi
and R.J.Schilling [1989] have suggested such a method. Using an environment of polygons, the
pathways may be represented with Voronoi diagrams, then represented in a graph.

Figure B.6 Voronoi Diagram of Simple Work Space

Mid-Points Between Obstacles

After the Voronoi diagram has been set up in graph form, a path may be found. This is simplified
by the use of some heuristic rules for wide paths, tight bends, narrow gaps, and reversing,
which identify a number of orientations. This procedure produces short smooth paths (which
avoid obstacles) for 2D objects on an IBM compatible computer with no co-processor in 10
seconds to 1 minute. This method has potential for use with vision systems. Algorithms sug-
gested by A.C.Meng [1988] allow for fast udate ofVoronoi diagrams, in a changing environ-
ment. This makes the operation much faster, by avoiding the complete reconstruction of the
diagram, and makes real time trajectory correction feasible.

40.10.7 SPATIAL PLANNING : GENERAL INTEREST


E.G.Gilbert and D.W.Johnson [1985] created an optimization approach to path planning (with
the piano movers problem), with rotations and collision avoidance. This method runs 10 to 20
minutes on a Harris-800 computer. This method was based on work which was later published by
E.G.Gilbert, D.W.Johnson, and S.S.Keerthi [1987] which provides algorithms for calculating
distances between convex (and concave) hulls in a very short time (order of milliseconds).

40.10.8 SPATIAL PLANNING - VGRAPHS


A method proposed by K.Kant and S.Zucker [1988] involves collision avoidance of rectangles
based upon the search of a VGRAPH. This method also suggests the use of a Low Level controller
Collision Avoidance Module. This controller would use low level information about the
page 731

environment to behave as if experiencing forces from workspace obstacles. The manipulator


would be experiencing a pull to the goal state. This method produces a Kinematic and Dynamic,
Time Optimal path. None of the implementation details were given in the paper.

Figure B.7 - Visibility of Corners of Rectangles (VGRAPH)

Goal

Start

Visible Paths Between Corners are Shown

40.11 APPENDIX C - TRANSFORMED SPACE


Some methods find it beneficial to transform the representation of space, so that it simplifies
the search for the path. These methods may often be based on Spatial Planning, or any other
technique, but they all remap space. These methods are usually very inflexible after mapping, and
all environmental changes requires a remapping.

40.11.1 TRANSFORMED SPACE : CARTESIAN CONFIGURATION SPACE


The Configuration Space method was popularized by Lozano-Perez and Wesley (1979), and
was clarified later by Lozano-Perez (1983). The technique of Lozano-Perez and Wesley has
become a very popular topic in path planning and is worth an exhaustive discussion. The method
provides a simplified technique which will allow movement of one object through a scattered set
of obstacles. This is done by simplifying the problem to moving a point through a set of obstacles.
The major assumption of this technique is that the objects do not rotate and obstacles are all fixed
convex polygons. The obstacles must be fixed to limit the complexity of the solution.
page 732

Figure C.1 Configuration Space (Find Space & Find Path)

U G where:
U = Universe of Object and Obstacles,
A

B1
R = Configuration
B2 Space,
S
A
R G’

Grow obstacles to B’1


Configuration Space, B’2
with Find Space S’

R G’

B’1 Find Path between Obstacles


B’2 in Configuration Space.
S’

The basic concept involves shrinking the moving object to a single reference point. This is
done by growing the obstacles so that their new area covers all of the space in which the object
would collide with the obstacles. After the determination of configuration space the problem
is then reduced to moving a point through an array of obstacles (i.e.. through the free space).
Unfortunately, a set of obstacles which have been grown are good only for an object which has
no rotation throughout its path. This problem is not insurmountable, and may be over come by
creating a special representation of the moving object which identifies free space for the object
to rotate in. This object will be a convex hull shaped to cover the area swept out when the
block rotates about the reference vertex. The convex hull is used to grow the obstacles in con-
figuration space, to find a possible rotation point. Then the path is planned by, finding a path
to the rotation point in the first orientation, and a path from the rotation to the goal in the sec-
ond orientation. The path may also be broken up into more than one rotation, as need
demands. Each of these configuration space maps at different orientations are called slices.
As seen in the Figure A.4, this has the potential of eliminating some potential paths, or compli-
cating the problem.
page 733

Figure C.2 Object Rotation in Config Space

U G
A’

B1
B2
S
A
U G
A

Approximate object B1
with polygon which B2
covers all orientations. S
A
R G’

B’1 Grow objects with


approximated polygon.
B’2
S’

R G’

The rotation of the object


may be done at any point B’1
not touched by the polygons B’2
S’

The algorithmic technique which Lozano-Perez suggests is a two step solution to the ’Spatial
Planning Problem’. His solution covers two main algorithms, Findspace and Findpath. He
compares the Findspace algorithm to finding a space in a car trunk for a suitcase. This is the part
in which the obstacles are grown to two or three dimensions, rotations are accounted for, and
degrees of freedom are considered. At this point is should be considered that the tendency is to
work in cartesian coordinates, but use of other representations could simplifiy the object
expansion, and the conversion to a VGRAPH. The Findpath problem is comparable to
determining how to get the suitcase into that empty space. The Findpath algorithm determines the
best path by finding a set of connecting free points in the Configuration Space. To do this a simple
page 734

three step process has been used. The objects are first grown, and then a set of vertices for each is
determined. Next the vertices are check for visibility (ie. can they be seen from the current point?)
and a VGRAPH is constructed, and finally a search of the VGRAPH yields a solution. This is a
good example of the problem solving techniques of artificial intelligence.
It is very obvious that the technique is not very advanced by itself. There has been some
expansion on advanced topics, and these will be discussed below. Another consideration is the
addition of a three dimensional setting. This becomes a much more complex problem because
of the need to deal with deriving the hulls, locating intersections, finding enveloped points in
space. When we expand to three dimensional space the algorithm is still attempting to navi-
gate by corner vertices. In three dimensional trajectories the best paths are usually around
edges of objects. A trick must be used to make the search graphs recognize the edges. The
trick used is each edge is subdivided from a line with two vertices into a number of smaller
lines (with a maximum length limit) and a greater number of vertices. This obviously does not
ease the calculation time problem in three dimensions. Another trick is to use care points,
located either inside or outside the objects, and then use these as points which require precise
calculation nearby, and allow crude calculation when distant.
We must also consider the complexity introduced when a multi link manipulator is to be
moved. Our object now becomes a non-convex hull, or a set of convex hulls, possibly repre-
sented as the previous slices represented rotations.
An alternate development of the configuration space method was done by R.H.Davis and
M.Camacho [1984], which implements the Lozano-Perez methods in Prolog under UNIX.
They basically have formulated the problem using the A* search, with a deeper development
of the Path Finding Heuristics. Another variation on the Configuration Space Method was that
of R.A.Brooks and Lozano-Perez [1985]. Configuration space was sliced and then broken into
cells which could be full, half full or empty. From this representation a connectivity graph
would be produced, and the A* search would be used to find a path, This technique required
alterations to both the FindPath and FindSpace routines. This technique does allow rotations (
but the run time is in the order of tens of minutes on an MIT LISP machine).
An approach for using Cartesian Configuration Space on a Stanford Manipulator (1 Prismatic
Joint) was proposed by J.Y.S.Luh and C.E.Campbell [1984]. This method had to consider both
the front and the rear travelway for the sliding prismatic link. To do this the manipulator was
shrunk to a point, and the rear obstacles translated to the ’front workspace’. The method also
makes use of an algorithm for converting non-polygonal shapes to good approximation convex
polygons. There were no statistics given with this method.
Configuration Space was used by J.Laumond [1986] to do planning for a two wheeled
mobile robot. This method was successful in using configuration space to find paths from
some very difficult problems. The best example given of the success of this technique is the
Parking Spot problem. In this case the wheeled robot is very similar to an automobile which is
stuck between two other parked cars. To get out the robot had to move in both forward and
reverse directions to manoeuvre out of the ’tight spot’.
As for evaluating the overall success of this technique, the computational limits are the major
concern. Lozano-Perez, claims success in a laboratory setting with his configuration space
path planning routines on a seven degree of freedom manipulator. But he does not note his
execution speed, nor does he describe his results quantitatively. This technique was imple-
mented previously by Udupa (1977) for computer control of manipulators. His experiment
used a robot with three approximated degree of freedom, in three dimensions. Because of the
page 735

three degree of freedom limit, the robot was limited in cluttered environments, and had to
depend upon some heuristics. His technique also made use of a variable description of space,
using recursive addition of straight paths. The recursive determination of paths has some of
the same drawbacks that the swept volume method has, and this is what Lozano-Perez and
Wesley overcame with their graph search method. This technique is very useful for planning 2
dimensional paths, based on the easy and speed of calculation. There is also no doubt that this
technique could be made to work with a more complex robot path planning problem, but the
computational speed would be a major factor. Lozano-Perez and Wesley (1979) implemented
their algorithms on an IBM370/168 in PL/1. This technique does not handle rotations well,
and the result may be a non-optimal solution, or possibly even no solution. The algorithm will
provide the shortest distance path, with collision avoidance, but it may not produce continuous
paths. Lozano-Perez (1983) also discusses his algorithms in depth which means that his meth-
odology is easy to incorporate in other projects.

40.11.1.1 - TRANSFORMED SPACE :


A CARTESIAN CONFIGURATION SPACE APPLICATION
A use of the Configuration Space method was made by C.Tseng, C.Crane and J.Duffy [1988]
for a good solution to the pick and place problem. The objects as 2.5D in the environment by
represention as upward extruded polygons. First the objects are grown to compensate for the cross-
section of the manipulator. The manipulator arm is then ’lifted up’ to ensure clearance of all the
objects in its path. This method may fail in the presence of very tall objects. The method was
implemented on a VAX 750 and could find paths in cluttered workcells in under 2 seconds.

40.11.2 TRANSFORMED SPACE : JOINT CONFIGURATION SPACE


The Cartesian Configuration Space Method uses a check for which particular points in space
are free, and then chooses a free path through. This is not very useful when expanding to a
multilink manipulator. Thus an approach has been formulated to determine which points in joint
space are collision free. This method was formulated by W.E. Red and Hung-Viet Truong-Cao
[1985]. This method was applied to manipulators with two revolute joints, and to a robot with one
revolute and one prismatic joint. This method works best with two joints, and expansion to three
joints requires more computation time. Thus this solution is ideal when the robot is operating in a
2D planar configuration. The effect is a setup time of 2 to 5 minutes, and then 15 seconds for any
solution after the initial setup.
page 736

Figure C.3 Joint Configuration Space for two Revolute Joints


A2
-180 0 180
180
A2
A1
0
A1

-180
Start State
Joint Space Map (in degrees)

A2
-180 0 180
180
G
S
A1
0

-180
Goal State Path in Joint Space

This technique has some definite advantages in the speed of solution. Resolution errors occur due
to the resolution of the configuration space map. This table can only be used for the motion of
two joints, the third increases the complexity exponentially, but it is still ideal for some batch
processing applications.

40.11.3 TRANSFORMED SPACE : OCT-TREES


An interesting method created by B.Faverjon [1986] is to constructively model solid objects
(via a custom CAD program) and then generate an Oct-tree representation of joint space from
these. The A* search is used to find trajectories in the Oct-tree. This method works in cluttered
environments for pick and place operations. The method was solved on a Perkin-Elmer mini-
computer in under a minute.

40.11.4 TRANSFORMED SPACE : CONSTRAINT SPACE


K.L.Muck [1988] tried a different sort of mapping technique. Space is represented in an Oct-
tree, with the Oct-tree representing robotic motion constraints in the environment. A connectivity
graph is then generated from the Oct-tree and the A* search is used. The main thrust of this routine
page 737

is to reduce the problem to solving the specific motion constraints which apply to the current
condition. This technique was implemented for a single link manipulator in a convex hull
environment.

40.11.5 TRANSFORMED SPACE : VISION BASED


Some of the potential of Spatial Planning is exposed in some of the current research. To allow
the development of vision for use in the field of path planning, E.K. Wong and K.S. Fu [1986] have
done some research. This research allows a path planning method to be run with three views of a
work cell, and from these three views deduce the maximum filled volume. Once the information
from the vision system has been interpreted to provide the basic world model, then the objects may
be grown into configuration space for an arbitrary moving object. The three views of the object
then may be examined from each of the three views, to determine the free path. This premise is
based on the idea that if a clear path is visible in one view, then it is a clear path in three dimensional
space. This technique uses oct-trees for the representation of space, thus the technique may be very
efficient (depending upon the resolution of the oct-tree). This method was implemented on a VAX
11/780 to find a path for an obstacle in three space in 1 to twenty seconds (depending upon the oct-
tree search depth). This had not been mated to a vision system in the cited paper.

40.11.6 TRANSFORMED SPACE : GENERAL INTEREST

E.Palma-Villalon and P.Dauchez [1988] came up with a method to do fast path planning for a
mobile robot. Rectangles are used to represent obstacles, and the moving robot is represented
with a circle. The obstacles are grown by the radius of the circle (into configuration space). A
map is created with a course resolution is made to indicate which objects are present in a grid
box.
page 738

Figure C.4 Grid Representation of Space

1 1
1
Maps to 1 1,2 2
2

3 3
3
3 3

Floor Layout Floor Layout Map


(by objects in cell)

This map only indicates an objects presence, the remainder of the information is kept in a
concurrent list. By finding and using a series of holes and walls within the grid an A* search is
applied to find the best path. The cost function of the search is based on the path length and the
number of turns made. The performance of this method is not stated, and thus no basis for
comparison is available. This method provides straight line path segments. The mapping to
configuration space could be convenient for the first pass of a path planner for general path finding.

40.12 APPENDIX D - FIELD METHODS


In an attempt to model ’natural flow’, there have been attempts to use gradients and potentials
to choose natural path choices. These methods use the equivalent of field representations to
provide a direction of travel that is ’down hill’. These methods have long setup times, and they can
get caught. These techniques will benefit the most as more powerful computer hardware becomes
available.

40.12.1 SPATIAL PLANNING : STEEPEST DESCENT


In an attempt to find a fast path planning method, the steepest descent method was proposed
by P.W.Verbeek, L.Dorst, B.J.H. Verwer, and F.C.A. Groen [1987]. Their method is an array
based method which will take the workspace represented polygons. This array is a two dimension
representation of space in which the goal position is represented with a zero value, and the objects
are represented with a value of infinity. Each element of the array is considered in a series of
iterations over the array. The result of these iterations is a map of a ’height’ with respect to the
goal state. The method then just follows the steepest gradient, down to the goal state.
page 739

Figure D.1 Steepest Descent Representation and Path

goal

start

A Distance Map

This method has been implemented for a 2D multilink manipulator, but it uses 4 Mbytes of
memory for a workspace resolution of 32 by 32 by 32. On a 12 MHz, 68000 VME computer
system the whole process takes about 12 seconds. This is broken up into a 6 seconds for detec-
tion and labelling of forbidden states, a 6 second generation of distance landscape, and less
than a second for finding the shortest path by steepest descent.

40.12.2 SPATIAL PLANNING : POTENTIAL FIELD METHOD


When considering that the basic thrust of the path planning methods is to avoid obstacles, it
is easy to compare this avoidance to repulsion. The basic concept of repulsion is based on potential
fields, as thus the potential field method of W.T.Park [1984]. In particular, the method was
directed towards a workcell with multiple manipulators. In this setting there is a problem with
potential manipulator collisions, which must be considered when path planning. To do this a
planar view of the work cell is created, and the arms are given a potential. The potential repulsion
of the manipulators is mapped for a number of various joint and slider positions. In the work of
Park, a manipulator with two revolute joints, and a Stanford manipulator is used. Both of the
manipulators have two degrees of freedom, thus a number of two dimensional arrays are necessary
to fully describe the work space. This memory requirement is very large, and thus is one of the
drawbacks of this technique. The Even with the use of compression techniques, the arrays still
consume over 100 KBytes each. In the experimental implementation, the computer used was a
VAX 750. The problem was constrained to 4 d.o.f., which used 2 MBytes of memory, and took 8
hours of computation time, to calculate about a million combinations. This method may also get
caught in cul-de-sacs. The bottom line on this method is it highly oriented to batch and workcell
operations, but too staggering to consider for use in a practical system.
In a more complex vein, Y.K.Hwang and N.Ahuja [1988] have developed a method using
polygons and polyhedra to represent objects, from which a potential field is generated. First
page 740

general topilogical paths are found from valleys of potential minimums. The best of these
paths is selected, and three FindPath algorithms are used to refine it, until it is acceptable. The
first algorithm moves along the path and reduces potential numerically. Second, a tight fit
algorithm is used for small pathways. Lastly, an algorithm which will move off the given path
if necessary is used, as a last resort. This method has been implemented to run on a SUN 260
for a ’Piano Movers Problem’. The total runtime is in the tens of minutes, and it does fail in
certain cases.
To avoid becoming trapped when using this method, another approach was developed to
mapping the potential field by P.Khosla and R.Volpe [1988]. They have developed an alternate
approach which avoids the local minima found in traditional potential field methods. To do
this they have used superquadratic approximation of the potential fields to drop off from obsta-
cles swiftly. The superquadratic is used to have a gradual slope to the goal, thus to make sure
that its effect is more wide spread than the obstacles. The results which they have obtained are
not described, but they have written a program which will work with a two link manipulator,
ignoring link collisions.

40.13 APPENDIX E - NEWAND ADVANCED TOPICS


There are some methods of path planning which cannot be easily classified into the four
preceeding divisions. These are listed here, and they are devided into advanced topics, which are
ahead of their time, and new topics which are still awaiting implementation.

40.13.1 ADVANCED TOPICS : DUAL MANIPULATOR COOPERATION


Dual manipulator cooperation is an interesting concept that allows maximum use of the
manipulators. When a payload is encountered that is too heavy, or bulky, for a single manipulator,
a second manipulator may be used in unison with the first. I.H.Suh and K.G.Shin [1989] have
developed some of the theoretical requirements for two manipulators to carry a single large object.
This is done through assigning one manipulator as the leader, and the second as the follower. To
overcome the problem caused by the limited degrees of freedom, their method allows one
manipulator to ’slide’ with respect to the other during the carrying process. If two 6 degree of
freedom manipulators were to try and carry a piece together they would find limits. By allowing
one manipulator to slide, it is equivalent to adding 1 degree of freedom to the system.
A paper on optimal arm configurations is given by S.Lee [1989]. A method is discussed for
identifying optimal dual arm control based on manipulability ellipsoids. This is a lengthy
paper outlining all of the details of the method.

40.13.2 ADVANCED TOPICS : A POSTIERI PATH PLANNER


A Sensor Based path planning strategy was devised by (E.Fruend and H.Hoyer [1988]) which
allows real time trajectory planning and collision avoidance. This strategy is achieved in a
hierarchical system, which is also presented in this paper. This strategy is based on non-linear
page 741

control theory, and it considers four cases,

1. Moving Arms, Stationary Robots, Stationary Obstacles, and Constant Obstacle Size.
2. Stationary Arms, Mobile Robots, Moving Obstacles, and Constant Obstacle Size.
3. Moving Arms, Mobile Robots, Moving Obstacles, and Variable Obstacle Size.
4. Moving Arms, Mobile Robots, Moving Obstacles, and Constant Obstacle Size.

the calculations of the trajectories in this technique are done on the order of milliseconds, and this
shows great potential as the low end of a Dynamic Planner, which is completly autonomous.
This method considers the Dynamics of manipulators as well, and attempts to generate a mini-
mum time trajectory, which is collision free.

40.13.3 NEW TOPICS - SLACK VARIABLES


The use of slack variables has been suggested vaguely in a paper by S.C.Zaharakis and A.Guez
[1988]. This uses a 2D environment filled with boxes, in which an A* algorithm is used to find
paths. This method finds paths considering bang-bang (full on or full off) control theory, and the
manipulator dynamics, to find minimum time paths. The implementation was done on a MAC II,
and found results in under a minute.

40.14 REFERENCES:

A.P.Ambler, "Robotics and Solid Modelling: A Discussion of the Requirements Robotic Applica-
tions Put on Solid Modelling Systems", 2nd International Symposium Robotics Research
1985, pp 361-367.

R.A.Brooks, T.Lozano-Perez, "A Subdivision Algorithm in Configuration Space for Findpath


with Rotation" IEEE Transactions on Systems, Man, and Cybernetics, Vol.SMC-15, No.2,
Mar/Apr 1985, pp 224-233.

R.A.Brooks, "Planning Collision-free Motions for Pick-and-Place Operations", The International


Journal of Robotics Research, Vol. 2, No. 4, Winter 1983, pp 19-44.

R.A.Brooks, "Solving the Find-Path Problem by Good Representation of Free Space" IEEE
Transactions on Systems, Man, and Cybernetics (Mar/Apr 1983) Vol.smc-13, No.3, pp 190-
197.
page 742

R.O.Buchal, D.B.Cherchas, "An Iterative Method for Generating Kinematically Feasible Interfer-
ence-free Robot Trajectories", Future Publication in Robotica.

R.H.Davis, M.Camacho, "The Application of Logic Programming to the Generation of Paths for
Robots" Robotica (1984) vol.2, pp 93-103.

S.Dubowsky, M.A. Norris, Z. Shiller, "Time Optimal Trajectory Planning for Robotic Manipula-
tors with Obstacle Avoidance: A CAD Approach", Proceedings 1986 IEEE International Con-
ference on Robotics and Automation, pp.1906-1912, San Francisco, California, April 1986.

B.Espiau, R.Boulic, "Collision Avoidance for Redundant Robots with Proximity Sensors", The
Third International Symposium of Robotics Research, 1986, pp243-251.

E.Freund, H.Hoyer, "Real-Time Pathfinding in Multirobot Systems Including Obstacle Avoid-


ance", The International Journal of Robotics Research, Vol. 7, No. 1, February 1988, pp 42-70.

B. Faverjon, "Object Level Programming of Industrial Robots", Proceedings 1986 IEEE Interna-
tional Conference on Robotics and Automation, San Francisco, April 1986, pp 1406-1412.

B.Faverjon, P.Tournassoud, "A Local Based Approach for Path Planning of Manipulators With a
High Number of Degrees of Freedom", 1987 IEEE International Conference on Robotics and
Automation, Raleigh, North Carolina, March-April 1987, pp 1152-1159.

K.S.Fu, R.C.Gonzalez, C.S.G.Lee, "Robotics; Control, Sensing, Vision, and Intelligence", New
York: McGraw Hill, 1987.

E.G.Gilbert, D.W. Johnson, "Distance Functions and Their Application to Robot Path Planning in
the Presence of Obstacles", IEEE Journal of Robotics and Automation, Vol. RA-1, No. 1,
March 1985.

E.G.Gilbert, D.W.Johnson, S.S.Keerthi, "A Fast Procedure for Computing the Distance Between
Complex Objects in Three Space", 1987 IEEE International Conference on Robotics and Auto-
mation", pp. 1883-1889, Raleigh, North Carolina, March-April 1987.

J.H.Graham, "Comment on "Automatic Planning of Manipulator Transfer Movements"", IEEE


Transactions on Systems, Man, and Cybernetics, Vol. SMC-14, No.3, May/June 1984, pp 499-
500.

Y.K.Hwang, N.Ahuja, "Path Planning Using a Potential Field Representation", Proceedings 1988
IEEE International Conference on Robotics and Automation, Philadelphia, April 1988, pp
648-649.

Y.Kanayama, "Least Cost Paths with Algebraic Cost Functions", 1988 IEEE International Confer-
ence on Robotics and Automation, Philadelphia, Pennsylvania, April 1988, pp 75-80.
page 743

K.Kant, S.Zucker, "Planning Collision-Free Trajectories in Time-Varying Environments: A Two-


Level Hierarchy", Proceedings 1988 IEEE International Conference on Robotics and Automa-
tion, Philadelphia, April 1988, pp 1644-1649.

P.Khosla, R.Volpe, "Superquadratic Artificial Potentials for Obstacle Avoidance and Approach",
Proceedings 1988 IEEE International Conference on Robotics and Automation, Philadelphia,
April 1988, pp 1778-1784.

S.Kirkpatrick, C.D.Gelatt, M.P.Vecchi, "Optimization by Simulated Annealing", Science, 13 May


1983, Vol.220, No.4598, pp 671-680.

J.C.Latombe, C.Laugier, J.M.Lefebvre, E.Mazer, "The LM Robot Programming System", 2nd


International Symposium of Robotics Research, 1985, pp377-391.

J. Laumond, "Feasible Trajectories for Mobile Robots with Kinematic and Environment Con-
straints", Intelligent Autonomous Systems, An International Conference held in Amsterdam,
The Netherlands, December 1986, pp 346-354.

B.H.Lee, Y.P.Chien, "Time Varying Obstacle Avoidance for Robotic Manipulators: Approaches
and Difficulties", 1987 IEEE International Conference on Robotics and Automation, Raleigh,
North Carolina, March-April 1987, pp 1610-1615.

S.Lee, "Dual Redundant Arm Configuration Optimization with Task-Oriented Dual Arm Manipu-
lability", Vol. 5, No. 1, February 1989, pp.78-97.

A.Liegeois, P.Borrel, E.Dombre, "Programming, Simulating and Evaluating Robot Actions", The
Second International Symposium of Robotics Research, 1985, pp 411-418.

T.Lozano-Perez, M.A.Wesley, "An Algorithm for Planning Collision Free Paths Among Polyhe-
dral Obstacles" Communications of the ACM (October 1979) vol.22, no.10, pp 560-570.

T. Lozano-Perez, "Spatial Planning: A Configuration Space Approach" IEEE Transactions on


Computers, Vol.c-32, No.2, February 1983.

J.Y.S.Luh, C.E.Campbell, "Minimum Distance Collision-Free Path Planning for Industrial Robots
with a Prismatic Joint", IEEE Transactions on Automatic Control, Vol. AC-29, No. 8, August
1984.

A.C.Meng, "Dynamic Motion Replanning for Unexpected Obstacles", Proceedings 1988 IEEE
International Conference on Robotics and Automation, Philadelphia, April 1988, pp 1848-
1849

K.L.Muck, "Motion Planning in Constraint Space", Proceedings 1988 IEEE International Confer-
ence on Robotics and Automation, Philadelphia, April 1988, pp 633-635.

N.J. Nilsson, "A Mobile Automaton: An Application of Artificial Intelligence Techniques" Pro-
page 744

ceedings International Joint Conference Artificial Intelligence, 1969, pp 509-520.

E.Palma-Villalon, P.Dauchez, "World Representation and Path Planning for a Mobile Robot",
Robotica (1988), Volume 6, pp 35-40.

W.T.Park, "State-Space Representation for Coordination of Multiple Manipulators", 14th ISIR,


Gothenburg, Sweden, 1984, pp 397-405.

K.Rao, G.Medioni, H.Liu, G.A.Bekey, "Shape Description and Grasping for Robot Hand-Eye
Coordination", IEEE Control Systems Magazine, Vol.9, No.2, February 1989, pp.22-29.

W.E.Red, H.V.Truong-Cao, "Configuration Maps for Robot Path Planning in Two Dimensions"
Journal of Dynamic Systems, Measurement, and Control (December 1985) Vol.107, pp 292-
298.

S.Singh, M.C.Leu, "Optimal Trajectory Generation for Robotic Manipulators Using Dynamic
Programming", Journal of Dynamic Systems, Measurement, and Control, June 1987, Vol. 109,
pp 88-96.

T.Soetadji, "Cube Based Representation of Free Space", Intelligent Autonomous Systems, An


International Conference held in Amsterdam, The Netherlands, December 1986, pp 546-560.

I.H.Suh, K.G. Shin, "Coordination of Dual Robot Arms Using Kinematic Redundancy", IEEE
Transactions on Robotics and Automation, Vol.5, No.2, April 1989, pp. 236-242.

K.Sun, V.Lumelsky, "Computer Simulation of Sensor-based Robot Collision Avoidance in an


unknown Environment", Robotica (1987), volume 5, pp 291-302.

O.Takahashi, R.J.Schilling, "Motion Planning in a Plane Using Generalized Voronoi Diagrams",


IEEE Transactions on Robotics and Automation, Vol.5, No. 2, April 1989, pp 143-150.

C.Tseng, C.Crane, J.Duffy, "Generating Collision-FreePaths for Robot Manipulators", Computers


in Mechanical Engineering, September/October 1988, pp 58-64.

S. Udupa, "Collision Detection and Avoidance in Computer Controlled Manipulators" Ph.D. The-
sis, California Institute of Technology, Pasadena, California, 1977.

P.W.Verbeek, L.Dorst, B.J.H. Verwer, F.C.A.Groen, "Collision Avoidance and Path Finding
Through Constrained Distance Transformation in Robot State Space", Intelligent Autonomous
Systems, An International Conference held in Amsterdam, The Netherlands, December 1986,
pp 627-634.

M.Vukobratovic, M.Kircanski, "A Method for Optimal Synthesis of Manipulation Robot Trajec-
tories", Journal of Dynamic Systems, Measurement and Control, June 1982, Vol. 104, pp 188-
193
page 745

E.K. Wong, K.S.Fu, "A Hierarchical Orthagonal Space Approach to Three-Dimensional Path
Planning", IEEE Journal of Robotics and Automation, Vol. RA-2, No. 1, March 1986, pp 42-
53.

S.C.Zaharakis, A.Guez, "Time Optimal Navigation Via Slack Time Sets", Proceedings 1988 IEEE
International Conference on Robotics and Automation, Philadelphia, April 1988, pp 650-651.
page 746

41. ROBOTIC MECHANISMS


41.1 KINEMATICS

• A robot must be able to map between things that it can control, such as joint angles, to the posi-
tion of the tool in space.

• Describing the position of the robot in terms of joint positions/angles is Joint Space.

• Real space is often described with a number of coordinate systems,


- cartesian
- polar
- spherical

• Positions can also be specified with respect to the robot base (Robot Coordinates), or globally
(World Coordinates).

41.1.1 Basic Terms

link/joint coordinates

tool coordinates

base coordinates

• Robot base coordinates don’t move and are often used to specify robot tool position and orienta-
tion. (centre of the robots world)

• Link/Joint Coordinates - specify where joints, endpoints or centers are located.

• Tool coordinates - determine where the tool is and what orientation it is in.

• World Coordinates - relates various robots to other robots and devices.

• Coordinate transformation - Can map from one set of coordinates to another. Most common
method is matrix based. One special case of this is the Denavit-Hartenrberg transformation.
page 747

41.1.2 Kinematics

0.2m
1m

TCP
theta2 (xT, yT)

(x1,y1)
1m Note: When defining angles is is more con-
venient to indicate the positive direction
and origin (as shown with the solid line
for ‘theta 2’). With more classical
theta1
sketching we would use the dashed line,
(xb, yb)
but this leads to confusion with variable
robotic geometries.

• Forward kinematics involves finding the endpoint of the robot (xT, yT) given the joint coordi-
nates (theta1, theta2)

• There a number of simple methods for finding these transformations,


- basic geometry
- transformation matrices
- Denavit-Hartenberg transformations

41.1.2.1 - Geometry Methods for Forward Kinematics

• For simple manipulators (especially planar ones) this method is often very fast and efficient.

• The method uses basic trigonometry, and geometry relationships.

• To find the location of the robot above, we can see by inspection,


page 748

x T = x b + l 1 cos θ 1 + ( l 2 + 0.2 ) cos ( θ 1 + θ 2 )


y T = y b + l 1 sin θ 1 + ( l 2 + 0.2 ) sin ( θ1 + θ 2 )

often set to zero

The general form of the operation is as below,

( θ 1, θ 2, … ) → ( x T, y T, z T, θ Tx, θT y, θ Tz )

ASIDE: later we will see that the opposite operation


maps from tool coordinates, and is called the
inverse kinematics.
( θ 1, θ 2, … ) ← ( x T, y T, z T, θT x, θ Ty, θ Tz )

Also note that the orientation of the tool is included, as well as position, therefore for
the example,
θ Tx = 0

θTy = 0

θ Tz = θ1 + θ 2

• The problem with geometrical methods are that they become difficult to manage when more
complex robots are considered. This problem is overcome with systematic methods.

41.1.2.2 - Geometry Methods for Inverse Kinematics

• To find the location of the robot above, we can see by inspection,


page 749

Inverse kinematics maps from the tool coordinates to the joint coordinates.

( θ 1, θ 2, … ) ← ( x T, y T, z T, θT x, θ T y, θ Tz )

• Mathematically this calculation is difficult, and there are often multiple solutions.

41.2 MECHANISMS

• The mechanical structure of the robot has a major influence over performance. Typically closed
kinematic chains give higher strengths, but lower speeds and flexibility.

• The linkage shown below uses two cylinders (hydraulic or pneumatic) to give radial positioning
page 750

This robot has a closed linkage, and


any movements of the bottom cylin-
der will swing the top arm. The top
arm also has a linear slider that
moves in and out. This arrangement
reduces the load that must be carried
by the bottom cylinder.

41.3 ACTUATORS

• There are a large number of power sources that may be used for robots.

• Typical actuators include,


• Pneumatics
- simple, low maintenance
- light, least expensive
page 751

- low payload
- easy to find fault
- hard to do continuous control
• Hydraulic
- large payload
- high power/weight ratio
- leakage
- noisy
• Electrical
- feedback compatible
- computer compatible
- EOAT compatible
- quiet, clean
- low power/weight ratio

• Actuators lead to various payload capabilities as shown in the following list.

Robot Power Payload (k.g.) Max. Vel. (m/s)


Asea IRB/6 Electric 6 0.75
IBM 7535 Electric 6 1.45
Cincinatti T3/726 D.C. Motor 6.4 1.0
Devilbiss Hydraulic 6.8 1.83
Yaskawa L/10 Electric 10 1.1
Unimation 550/60 Electric 10 1.0
Hitachi Electric 10 0.99
Unimation 5000 D.C. Motor 14 0.53
VSI Charley #6 Electric 30 1.8
GMF M/1A Electric 46.7 0.99
Cincinatti T3/776 D.C. Motor 68 0.635
Cincinatti T3/586 Hydraulic 100 0.89

41.3.1 Modeling the Robot

• If modeling only one link in motion, the model of the robot can treat all the links as a single
moving rigid body,
page 752

θ, ω, α
CG, M, J

• If multiple joints move at the same time, the model becomes non-linear, in this case there are
two approaches taken,
1. Develop a full non-linear controller (can be very complicated).
2. Develop linear approximations of the model/control system in the middle of the normal
workspace.

41.4 PATH PLANNING

• Basic - “While moving the robot arm from point A to B, or along a continuous path, the choices
are infinite, with significant differences between methods used.”

41.4.1 Slew Motion

• The simplest form of motion. As the robot moves from point A to point B, each axis of the
manipulator travels as quickly as possible from its initial position to its final position. All axis
begin moving at the same time, but each axis ends it motion in a length of time that is propor-
tional to the product of its distance moved and its top speed (allowing for acceleration and
deceleration)

• Note: slew motion usually results in unnecessary wear on the joints and often leads to unantici-
pated results in the path taken by the manipulator.

• Example - A three axis manipulator with revolute joints starts with joint angles (40, 80, -
40)degrees, and must move to (120, 0, 0)degrees. Assume that the joints have maximum abso-
lute accelerations/decelerations of (50, 100, 150) degrees/sec/sec, and the maximum velocities
of (20, 40, 50) degrees/sec. Using slew motion, what is the travel time for each joint?
page 753

Joint angle (degrees)


180

90

time(sec)

θ3
θ2
-90 θ1

Joint velocity (degrees/sec)


ω max αmax

t acc t max t dec

The area under the velocity curve is the distance (angle in this case) travelled. First we
can determine the distance covered during acceleration, and deceleration and the
time during acceleration, and deceleration.

ω max
t acc = t dec = ------------ =  ------, ---------, --------- = ( 0.4, 0.4, 0.333 )sec.
20 40 50
αmax 50 100 150
t acc ω max.vel. 0.4 ( 20 ) 0.4 ( 40 ) 0.333 ( 50 )
θ acc. = θdec. = ---------------------------- =  ------------------, ------------------, ------------------------ = ( 4, 8, 8.33 )deg.
2 2 2 2

The next step is to examine the moves specified,


θ move = θ end – θ start = ( 120 – 40, 0 – 80, 0 – ( – 40 ) ) = ( 80, – 80, 40 )deg.

Remove the angles covered during accel./deccel., and find the travel time at maximum
velocity.
θ move – 2θ acc 80 – 2 ( 4 ) 80 – 2 ( 8 ) 40 – 2 ( 8.333 )
t max = ----------------------------------- =  -----------------------, -----------------------, ---------------------------------
ω max 20 40 50

t max = ( 3.6, 1.6, 0.46668 )sec. Note: below zero the speeds will
never reach maximum velocity
t total = t acc + t max + t dec = ( 4.4, 2.4, 1.13 )s before starting to decelerate.
page 754

41.4.1.1 - Joint Interpolated Motion

• Similar to slew motion, except all joints start, and stop at the same time. In the last example for
slew motion, all of the joints would have moved until all stopping simultaneously at 4.4 sec-
onds.

• This method only demands needed speeds to accomplish movements in least times.

41.4.1.2 - Straight-line motion

• In this method the tool of the robot travels in a straight line between the start and stop points.
This can be difficult, and lead to rather erratic motions when the boundaries of the workspace
are approached.

• NOTE: straight-line paths are the only paths that will try to move the tool straight through space,
all others will move the tool in a curved path.

• The basic method is,


1. Develop a set of points from the start and stop points that minimize acceleration.
2. Do the inverse kinematics to find the joint angles of the robot at the specified points.

• Consider the example below,


page 755

Given,

P 0 = ( 5, 5, 5 )in. P 1 = ( – 5, – 5, 5 )
t0 = 0 t1 = 2
d d
----- P 0 = ( 0, 0, 0 ) ----- P 1 = ( 0, 0, 0 )
dt dt

Model the path with a function that allows acceleration/deceleration, in this case a
third order polynomial will be used. The equation will be parameterized for sim-
plicity (i.e., s = [0,1], where s=0 is the path start, and s=1 is the path end).

P ( t ) = P0 + ( P1 – P 0 )s ( t )
d- d-
s ( t0 ) = 0 s ( t1 ) = 1 ---- s( t ) = 0 ---- s(t ) = 0
dt 0 dt 1

3 2
s ( t ) = At + Bt + Ct + D d- 2
---- s ( t ) = 3At + 2Bt + C
dt
Next, numerical values will be entered to find equation values

3 2
s(0) = A(0) + B(0 ) + C(0) + D = 0 ∴D = 0
3 2
s(2) = A(2) + B(2 ) + C(2) + D = 1 ∴8A + 4B = 1
d-
---- s ( 0 ) = 3A ( 0 ) + 2B ( 0 ) + C = 0 ∴C = 0
dt

∴ – --- A = B
d- 3
---- s ( 2 ) = 3A ( 2 ) + 2B ( 2 ) + C = 0
dt 2

8A + 4  – --- A = 1
3 1 3
∴A = --- ∴B = – ---
2 2 4
This can now be put in the final form,

3
P ( t ) = P 0 + ( P 1 – P 0 )  ---- – --- t 
t 32
2 4 

41.4.2 Computer Control of Robot Paths (Incremental Interpolation)


page 756

• Path Planning is a simple process where the path planning methods described before (such as
straight line motion) are used before the movement begins, and then a simple real-time lookup
table is used.

• The path planner puts all of the values in a trajectory table.

• The on-line path controller will look up values from the trajectory table at predetermined time,
and use these as setpoints for the controller.

• The effect of the two tier structure is that the robot is always shooting for the next closest ‘knot-
point’ along the path.

Desired
configuration Set point
Off-line Trajectory table
Current table Kinematic
path Transforms
Configuration planning

Done before motion begins


Done during motion, and all other times

Time based interrupt Servo motor routine runs


routine for each axis

Interrupt Choose new


Clock point from
trajectory table
Read θ desired

Set-point
table θ desired Compute
error

Output actuator
Return signal

• The above scheme leads to errors between the planned, and actual path, and lurches occur when
the new setpoints are updated for each servo motor.
page 757

speed
actual position

trajectory table

time
trajectory table time step

position
required

actual

time

• The quantization of the desired position requires a decision of what value to use, and this value
is fixed for a finite time.

• The result is that the path will tend to look somewhat bumpy,

The desired path tends to deviate from the points in the trajectory
table, and the tool tends to follow a path like In this case an
that pictured below. Moreover this scheme extra step is
will lead to uneven acceleration over added to
knot 5 end compensate for
the path segments
knot 4 the position errors
Path segments knot 3

knot 2
knot 1
start **Note: this occurs with straight-line motion also
page 758

41.5 PRACTICE PROBLEMS

1.
a) A stepping motor is to be used to actuate one joint of a robot arm in a light duty pick and place
application. The step angle of the motor is 10 degrees. For each pulse received from the pulse
train source the motor rotates through a distance of one step angle.
i) What is the resolution of the stepper motor?
ii) Relate this value to the definitions of control resolution, spatial resolution, and accu-
racy, as discussed in class.
b) Solve part a) under the condition that the three joints move at different rotational velocities.
The first joint moves at 10 degrees/sec., the second joint moves at 25 degrees/sec, and the third
joint moves at 30°/sec.

2. A stepping motor is to be used to drive each of the three linear axes of a cartesian coordinate
robot. The motor output shaft will be connected to a screw thread with a screw pitch of 0.125”.
It is desired that the control resolution of each of the axes be 0.025”
a) to achieve this control resolution how many step angles are required on the stepper
motor?
b) What is the corresponding step angle?
c) Determine the pulse rate that will be required to drive a given joint at a velocity of 3.0”/
sec.

3. For the stepper motor of question 6, a pulse train is to be generated by the robot controller.
a) How many pulses are required to rotate the motor through three complete revolutions?
b) If it is desired to rotate the motor at a speed of 25 rev/min, what pulse rate must be gen-
erated by the robot controller?

4. A stepping motor is to be used to actuate one joint of a robot arm in a light duty pick and place
application. The step angle of the motor is 10 degrees. For each pulse received from the pulse
train source the motor rotates through a distance of one step angle.
a) What is the resolution of the stepper motor?
b) Relate this value to the definitions of control resolution, spatial resolution, and accu-
racy, as discussed in class.

5. Find the forward kinematics for the robots below using geometry methods.
page 759

y y y

x x x

y y

x x

6. Consider the forward kinematic transformation of the two link manipulator below.

Pw(x, y)

L2 = 10” theta2 = 45 deg.

L1 = 12” y

x
theta1 = 30 deg.

a) Given the position of the joints, and the lengths of the links, determine the location of
the tool centre point using basic geometry.
b) Determine the inverse kinematics for the robot. (i.e., given the position of the tool,
determine the joint angles of the robot.) Keep in mind that in this case the solution
will have two different cases.
c) Determine two different sets of joint angles required to position the TCP at x=5”, y=6”.
d) What mathematical conditions would indicate the robot position is unreachable? Are
there any other cases that are indeterminate?
page 760

7. Find a smooth path for a robot joint that will turn from θ= 75° to θ = -35° in 10 seconds. Do this
by developing an equation then calculating points every 1.0 seconds along the path for a total
motion time of 10 seconds.

ans.
3 2
θ ( t ) = At + Bt + Ct + D θ ( 0 ) = 75 θ ( 10 ) = – 35
d- 2 d- d-
---- θ ( t ) = 3At + 2Bt + C ---- θ(0) = 0 ---- θ ( 10 ) = 0
dt dt dt
Solving
3 2
75 = A ( 0 ) + B ( 0 ) + C ( 0 ) + D
3 2
– 35 = A ( 10 ) + B ( 10 ) + C ( 10 ) + D
2
0 = 3A ( 0 ) + 2B ( 0 ) + C
2
0 = 3A ( 10 ) + 2B ( 10 ) + C
For A, B, C, D we get

3 2
θ ( t ) = ( 0.22 )t + ( – 3.3 )t + ( 75 )

t (sec) theta(t)

0 75
1 71.92
2 63.56
3 51.24
4 36.28
5 20
6 3.72
7 -11.24
8 -23.56
9 -31.92
10 -35

8. A jointed arm robot has three rotary joints, and is required to move all three axes so that the
first joint is rotated through 50 degrees; the second joint is rotated through 90 degrees, and the
third joint is rotated through 25 degrees. Maximum speed of any of these rotational joints is 10
degrees/sec. Ignore effects of acceleration and deceleration and,
a) determine the time required to move each joint if slew motion (joint motion is indepen-
dent of all other joints) is used.
b) determine the time required to move the arm to a desired position and the rotational
page 761

velocity of each joint, if joint interpolated motion (all joints start and stop simulta-
neously) is used.
c) Solve question 4 under the condition that the three joints move at different rotational
velocities. The first joint moves at 10 degrees/sec., the second joint moves at 25
degrees/sec, and the third joint moves at 30°/sec.

9. Consider the following motion planning problem.


a) A jointed arm robot has three rotary joints, and is required to move all three axes so that
the first joint is rotated through 50 degrees; the second joint is rotated through 90
degrees, and the third joint is rotated through 25 degrees. Maximum speed of any
of these rotational joints is 10 degrees/sec. Ignore effects of acceleration and decel-
eration and,
b) determine the time required to move each joint if slew motion (joint motion is indepen-
dent of all other joints) is used.
c) determine the time required to move the arm to a desired position and the rotational
velocity of each joint, if joint interpolated motion (all joints start and stop simulta-
neously) is used.

10. We are designing motion algorithms for a 2 degree of freedom robot. To do this we are devel-
oping sample calculations to explore the basic process.

a) We want to move the tool in a straight line through space from (3”, 5”) to (8”, 7”). Develop
equations that will give a motion that starts and stops smoothly. The motion should be complete in
1 second.

ANS.
P ( t ) = 3 + ( – 2t + 3t ) 5
3 2
5 2

b) Find the velocity of the tool at t=0.5 seconds.

ANS. d-
---- P ( t ) = 7.5
dt 3

c) Plot out the tool position, joint positions and velocities as functions of time.

11. Why do robots not follow exact mathematical paths?

12. We are designing motion algorithms for a 2 degree of freedom robot. To do this we are devel-
oping sample calculations to explore the basic process. We want to move the tool in a straight line
page 762

through space from (8”, 7”) to (3”, 5”). Develop equations that will give a motion that starts and
stops smoothly. The motion should be complete in 2 seconds. Show all derivations.

13.
page 763

42. MOTION PLANNING AND TRAJECTORY CON-


TROL

• When there are multiple control loops that must be controlled as a group we must add higher
level control techniques to plan motions and then guide single controllers.

42.1 TRAJECTORY CONTROL

• Given a set of points, we must move at given speeds.

42.1.1 Resolved Rate Motion Control

• When the robot motion is important (such as welding applications), the resolved rate method
may be useful

• This method requires a good model of the manipulator.

• The figure below shows an incremental interpolator, based on resolved rate motion control.

X d' + θ' d controller θ, ω


–1
J (θ) and robot
(PID, etc.)
-

X'
J(θ)

42.1.2 Cartesian Motion System

• The figure below illustrates a system for making motions in cartesian space (straight line).
page 764

X d, X d', Xd''
θ d, θ d', θ d'' θ, θ', θ''

inverse joint control


kinematics of robot

X, X', X''
forward
kinematics

42.1.3 Model Reference Adaptive Control (MRAC)

• To compensate for overly complex, or changing systems we can use an adaptive controller

τm
inverse dynamic
model

adaptation
equations
θ, θ', θ''
+
+ controller τc τ joint controllers
e, e d', e d'' + and robot
θ d, θd', θ d''
-

42.1.4 Digital Control System

• It is more common to use computers to control operations


page 765

Control Program updated every Ta seconds

actuator 1
D/A actuator 2
Computer etc.

sensor 1
sensor 2
A/D sensor 3
etc.
updated every Tb seconds

• The computer must examine sensors, then decide how to change outputs to actuators. But, com-
puters can only do one thing at once, so the approach is limited by CPU speed.

• Note the controlling computer still needs a control algorithm such as PID, resolved rate, MRAC,
etc.

• e.g. to control a simple robotic arm with proportional control


page 766

θ desired
Start
digital
read position from sensor number voltage
θ actual = 36.0V actual A/D from sensor
(e.g. potentiometer)

subtract for error


θerror = θ desired – θ actual

multiply for torque


τ = 100.0θerror

digital
write to actuator number voltage
V torque = 0.5τ D/A to actuator
(e.g., motor)

check for
error or stop e.g.,
e.g., θ actual < 180
no problem θ desired θ actual
time τ
(sec) (deg) (deg) (Nm)
turn off torque
0.0 10 0.0 1000
0.1 10 0.5 950
0.2 10 0.95 905
0.3 10 1.40 860
stop 0.4 10 1.75 850
0.5 10 etc.... etc...
0.6 10
0.7 10
0.8 10
0.9 10
1.0 10
1.1 10

• Some sensors, such as encoders can return binary numbers to the computer, instead of analog
voltages, this leads to more accurate, noise resistant position measurements.

• The main functions of the control computer are,


1. plans and interpolates a path from the start, to the endpoint in world coordinates.
2. Transforms path points from world to joint coordinates
3. Receives a signal about a completed move, and signals next moves on a path.
page 767

4. Executes other motions, not directly driving motion.

• There are two servo loops for each joint,


- the inner loop may consist of an amplifier (voltage or current), a joint drive, and a
tachometer for velocity feedback.
- the outer loop may consist of incremental encoder, counter or microprocessor,
- Microprocessor samples the contents of the counter (equal to the BRUs) and
transfers this to the computer. The computer compares the counter contents with
a program reference to produce the system error. The error signal is fed each ms
(for example) to a D/A converter which supplies a voltage proportional to the
required axis velocity.

• Advantages,
- complex calculations for control are possible
- software is easy to change for new control laws
- the controller can be adapted easily to new operating conditions
- the computer does not need retuning, reducing the amount of maintenance required
- faults can be easily detected

• Disadvantages,
- the computer may be unable to calculate fast enough
- the computer is generally less reliable

42.2 PATH PLANNING

• Basic - “While moving the robot arm from point A to B, or along a continuous path, the choices
are infinite, with significant differences between methods used.”

42.2.1 Slew Motion

• The simplest form of motion. As the robot moves from point A to point B, each axis of the
manipulator travels as quickly as possible from its initial position to its final position. All axis
begin moving at the same time, but each axis ends it motion in a length of time that is propor-
tional to the product of its distance moved and its top speed (allowing for acceleration and
deceleration)

• Note: slew motion usually results in unnecessary wear on the joints and often leads to unantici-
pated results in the path taken by the manipulator.

• Example - A three axis manipulator with revolute joints starts with joint angles (40, 80, -
40)degrees, and must move to (120, 0, 0)degrees. Assume that the joints have maximum abso-
page 768

lute accelerations/decelerations of (50, 100, 150) degrees/sec/sec, and the maximum velocities
of (20, 40, 50) degrees/sec. Using slew motion, what is the travel time for each joint?

Joint angle (degrees)


180

90

time(sec)

θ3
θ2
-90 θ1

Joint velocity (degrees/sec)


ω max αmax

t acc t max t dec


page 769

The area under the velocity curve is the distance (angle in this case) travelled. First we
can determine the distance covered during acceleration, and deceleration and the
time during acceleration, and deceleration.

ω max
- =  ------, ---------, --------- = ( 0.4, 0.4, 0.333 )sec.
20 40 50
t acc = t dec = -----------
αmax  50 100 150
t acc ω max.vel. 0.4 ( 20 ) 0.4 ( 40 ) 0.333 ( 50 )
- =  ------------------, ------------------, ------------------------ = ( 4, 8, 8.33 )deg.
θ acc. = θdec. = ---------------------------
2  2 2 2 

The next step is to examine the moves specified,


θ move = θ end – θ start = ( 120 – 40, 0 – 80, 0 – ( – 40 ) ) = ( 80, – 80, 40 )deg.

Remove the angles covered during accel./deccel., and find the travel time at maximum
velocity.
θ move – 2θ acc 80 – 2 ( 4 ) 80 – 2 ( 8 ) 40 – 2 ( 8.333 )
- =  -----------------------, -----------------------, ---------------------------------
t max = ----------------------------------
ω max  20 40 50 

t max = ( 3.6, 1.6, 0.46668 )sec. Note: below zero the speeds will
never reach maximum velocity
t total = t acc + t max + t dec = ( 4.4, 2.4, 1.13 )s before starting to decelerate.

42.2.1.1 - Joint Interpolated Motion

• Similar to slew motion, except all joints start, and stop at the same time. In the last example for
slew motion, all of the joints would have moved until all stopping simultaneously at 4.4 sec-
onds.

• This method only demands needed speeds to accomplish movements in least times

42.2.1.2 - Straight-line motion

• In this method the tool of the robot travels in a straight line between the start and stop points.
This can be difficult, and lead to rather erratic motions when the boundaries of the workspace
are approached.

• NOTE: straight-line paths are the only paths that will try to move the tool straight through space,
all others will move the tool in a curved path.
page 770

• The basic method is,


1. Develop a set of points from the start and stop points that minimize acceleration.
2. do the inverse kinematics to find the joint angles of the robot at the specified points.

• Consider the example below,


page 771

Given,

P 0 = ( 5, 5, 5 )in. P 1 = ( – 5, – 5, 5 )
t0 = 0 t1 = 2
d d
----- P 0 = ( 0, 0, 0 ) ----- P 1 = ( 0, 0, 0 )
dt dt

Model the path with a function that allows acceleration/deceleration, in this case a
third order polynomial will be used. The equation will be parameterized for sim-
plicity (i.e., s = [0,1], where s=0 is the path start, and s=1 is the path end).

P ( t ) = P0 + ( P1 – P 0 )s ( t )
d- d-
s ( t0 ) = 0 s ( t1 ) = 1 ---- s( t ) = 0 ---- s(t ) = 0
dt 0 dt 1

3 2
s ( t ) = At + Bt + Ct + D d- 2
---- s ( t ) = 3At + 2Bt + C
dt
Next, numerical values will be entered to find equation values

3 2
s(0) = A(0) + B(0 ) + C(0) + D = 0 ∴D = 0
3 2
s(2) = A(2) + B(2 ) + C(2) + D = 1 ∴8A + 4B = 1
d-
---- s ( 0 ) = 3A ( 0 ) + 2B ( 0 ) + C = 0 ∴C = 0
dt

∴ – --- A = B
d- 3
---- s ( 2 ) = 3A ( 2 ) + 2B ( 2 ) + C = 0
dt 2

8A + 4  – --- A = 1
3 1 3
∴A = --- ∴B = – ---
2 2 4
This can now be put in the final form,

3
P ( t ) = P 0 + ( P 1 – P 0 )  ---- – --- t 
t 32
2 4 

42.3 MOTION CONTROLLERS


page 772

42.3.1 Computer Control of Robot Paths (Incremental Interpolation)

• Path Planning is a simple process where the path planning methods described before (such as
straight line motion) are used before the movement begins, and then a simple real-time lookup
table is used.

• The path planner puts all of the values in a trajectory table

• The on-line path controller will look up values from the trajectory table at predetermined time,
and use these as setpoints for the controller.

• The effect of the two tier structure is that the robot is always shooting for the next closest ‘knot-
point’ along the path.

Desired
configuration Set point
Off-line Trajectory table
Current table Kinematic
path Transforms
Configuration planning

Done before motion begins


Done during motion, and all other times

Time based interrupt Servo motor routine runs


routine for each axis

Interrupt Choose new


Clock point from
trajectory table
Read θ desired

Set-point
table θ desired Compute
error

Output actuator
Return signal
page 773

• The above scheme leads to errors between the planned, and actual path, and lurches occur when
the new setpoints are updated for each servo motor.

speed
actual position

trajectory table

time
trajectory table time step

position
required

actual

time

• The quantization of the desired position requires a decision of what value to use, and this value
is fixed for a finite time.

• The result is that the path will tend to look somewhat bumpy,
page 774

The desired path tends to deviate from the points in the trajectory
table, and the tool tends to follow a path like In this case an
that pictured below. Moreover this scheme extra step is
will lead to uneven acceleration over added to
knot 5 end compensate for
the path segments
knot 4 the position errors
Path segments knot 3

knot 2
knot 1
start **Note: this occurs with straight-line motion also

42.4 SPECIAL ISSUES

42.4.1 Optimal Motion

• Previous sections discuss common industrial methods for path planning, but these methods are
generally sub-optimal.

• The example below shows two paths, and the difference in motion time for torque limited actua-
tors.

e.g. time > 7 sec.


time approx 4.5 sec.

• In the example above, the arm is bent along the path to reduce the moment of inertia, and thus
allows faster motions, but this would not happen with any of the simple control schemes.

• Methods to find these paths efficiently are still in research phases.


page 775

42.4.2 Singularities

• Common types of singularities are,


- redundant configurations lead to indefinite solutions
- joints become straight, and infinite joint velocities are required
- positions that may be reached in an infinite number of ways.

• Most of these singularities became obvious mathematically.

• A simple type of singularity often occurs at the edge of the robot workspace

If the robot must move in the


direction indicated, at a finite
velocity, the elbow joint will
reach an infinite velocity as it
becomes straight. This is
impossible, but must be considered
when path planning.

• Another type of robot singularity occurs when the joints flip

As the arm reaches the centre position,


the elbow joint must theoretically supply
and infinite velocity to maintain the
straight-line path.

• Some forms of solution redundancy can also be considered singularities (the solution to these is
to examine the last position, and match the solution to it)
page 776

The left/right arm configuration could


lead to incorrect robot positions
along the path, while still being
mathematically OK.

42.5 PRACTICE PROBLEMS

1. For the Stanford arm below,

θ1

TOP VIEW

FRONT VIEW
r
TCP
θ2
d1

(0,0,0)
z
x

a) list the D-H parameters (Hint: extra “dummy” joints may be required)
b) Find the forward kinematics using homogenous matrices.
c) Find the Jacobian matrix for the arm.
d) If the arm is at θ1 = 45 degrees, θ2 = 45 degrees, r = 0.5m, find the speed of the TCP if
the joint velocities are θ’1 = 1 degree/sec, θ’2 = 10 degrees/sec, and r’ = 0.01 m/
sec.

2. Find a smooth path for a robot joint that will turn from θ= 75° to θ = -35° in 10 seconds. Do this
by developing an equation then calculating points every 1.0 seconds along the path for a total
page 777

motion time of 10 seconds.

3. A jointed arm robot has three rotary joints, and is required to move all three axes so that the
first joint is rotated through 50 degrees; the second joint is rotated through 90 degrees, and the
third joint is rotated through 25 degrees. Maximum speed of any of these rotational joints is 10
degrees/sec. Ignore effects of acceleration and deceleration and,
a) determine the time required to move each joint if slew motion (joint motion is indepen-
dent of all other joints) is used.
b) determine the time required to move the arm to a desired position and the rotational
velocity of each joint, if joint interpolated motion (all joints start and stop simulta-
neously) is used.
c) Solve question 4 under the condition that the three joints move at different rotational
velocities. The first joint moves at 10 degrees/sec., the second joint moves at 25
degrees/sec, and the third joint moves at 30°/sec.

4. Find a smooth path for a robot joint that will turn from θ= 75° to θ = -35° in 10 seconds. Do this
by developing an equation then calculating points every 1.0 seconds along the path for a total
motion time of 10 seconds.

5.
a) A jointed arm robot has three rotary joints, and is required to move all three axes so that
the first joint is rotated through 50 degrees; the second joint is rotated through 90
degrees, and the third joint is rotated through 25 degrees. Maximum speed of any
of these rotational joints is 10 degrees/sec. Ignore effects of acceleration and decel-
eration and,
b) determine the time required to move each joint if slew motion (joint motion is indepen-
dent of all other joints) is used.
c) determine the time required to move the arm to a desired position and the rotational
velocity of each joint, if joint interpolated motion (all joints start and stop simulta-
neously) is used.
page 778

42.6 MICROBOT OVERVIEW

The Microbot is a small 5 axis robot, using stepper motors. The controlling computer is in the
base, and uses a 6502 microprocessor. This computer has two serial ports (RS232) which can
be used to connect to dumb terminals, or PCs. There is a Basic like programming language
which allows users to directly control the robot, or write programs to do so. Inside the robot,
the stepper motors drive the robot through the use of gears, and pulleys. This arrangement
allows for a great deal of backlash in the robot. (Try pushing the robot, and you will notice the
play).

The use of stepper motors has a number of implications. Common stepper motors divide one rota-
tion of a shaft into 200 divisions. The motor controller can then accurately position the shaft.
This means once the absolute position of the robot has been determined, a certain number of
motor steps, in either direction will result in a known position. This mode of control means that
feedback sensors are not required for the robot (although a calibration step is required before
motion). The stepper motors are not very strong, and if their ‘slip torque’ is overcome, then
they will lose their position, and without feedback the robot position will be in error until reca-
librated.

The only feedback to the controlling computer is for the gripper closed. There is a small spring
loaded contact switch which will indicate when the is a large force between the gripper fingers.
This allows objects of unknown size to be picked up, but not broken.

A teach pendant is available with the Microbot. This teach pendant allows a user to program the
robot without the use of languages, or other computers. The teach pendant allows the user to
move joints, then record robot positions. When the robot positions are played back in
sequence, they can perform some valuable manipulation.

In general this robot is very simple, and of no industrial use, but it displays many important con-
siderations for full size robots.

Practice: Try programming the robot to pick up a block from one location, move it to another,
then move it back again. You will notice some of the problems the robot has picking up the
block.

42.7 CRS PLUS ROBOT OVERVIEW

The CRS Plus is also a 5 axis robot, capable of carrying payloads of up to 2 Kg. It is run by DC
servo motors, which allow a smoother form of control, via chains, and gears (these result in
less backlash). While the Microbot is packaged in complete unit, the CRS Robot is much more
modular. The basic modules shipped with the robot are 1) the controller, 2) the Robot, 3) the
page 779

teach pendant, 4) the pneumatic gripper, and a separate air valve, and 5) Cables for connecting
devices, and connecting to a terminal, or PC. While this robot may also be programmed like
the robot, it is intended to be run with a computer or terminal.

The Controller is based on the 8086 microprocessor (found in early versions of the IBM PC), and
the unit also has an 8087 math coprocessor. There are two serial ports (RS232) available on the
controller, which may be used in a variety of configurations. The controller also has a number
of parallel data lines for control of other devices in the workcell, such as a pneumatic vice, and
a conveyor. The controller is designed to work off a normal 120 AC supply, and it handles
power supply for the robot motors.

42.8 BASIC DEMONSTRATION STEPS

1. Discuss Microbot, and show simple programming. Allow students to move robot to feel back-
lash, and stepper motor slip.

2. Go to CRS robot, and discuss robot in general terms. Show controller, wires, hoses, robot,
gears, chains, and allow students to move robot and feel backlash and DC servo motor for
comparison. Servo motors and encoders are discussed.

3. Set up PC as terminal, then, power up robot. Point out that the controller is on, but the robot
arm does not have power yet. Give power to arm, (point out the separate power on for safety)
then calibrate the robot home position. The robot is positions using the ‘manual’ command
with the teach pendant, then the ‘home’ command is used to zero the robot.

4. Basic motion commands for the controller are displayed using the commands ‘joint’, ‘ready’,
‘manual’, ‘motor’, ‘limp’, ‘nolimp’, ‘jog’.

5. The other I/O capabilities of the robot are shown using ‘open’, ‘close’, ‘output 2’, to control the
gripper, and the pneumatic vice respectively.

6. Robot position feedback is displayed using the commands ‘w0’, ‘wz’ ‘status’, to show various
positions in encoder pulses, degrees, Cartesian coords.

7. The joint control algorithms are discussed, and the effect of gain parameters on the PID control-
lers is demonstrated by varying the gain with the command ‘gain 0’. (The parameters are
changed from 8,.25,100 to 5,.25,100 for one long sweep of the arm, and vibrations will be
noticed because of controller overshoot). Discuss effects, and attempt to give practical implica-
tions. The tradeoff of speed and accuracy should be obvious here.

8. Programming is discussed using the program lists in the machines. The concept of memory
instead of disk is used. Programs are displayed, listed. etc using commands ‘free’, ‘dir’, ‘listp’,
‘edit’, ‘run’. A simple program is run for demonstration, and listed. (Also the RAPL language
is compared to Basic)
page 780

9. The use of points for enhancing programming is discussed. A list of points are shown using
‘listl’, and then the ‘approach’, ‘depart’, ‘move’, and ‘move ,s’ commands are used to move to
points by reference. ‘teach’ and ‘here’ are used to instruct the robot where the points are.

10. Positioning accuracy is measured using a sheet of paper taped to the table. A pen is put into
the robot gripper, and then a straight line motion is made. The distance measured will be
slightly different due to accuracy, and the line will wiggle because of control problems.

11. Repeatability is measured by putting a displacement gauge dial on the milling machine bed.
The robot is moved back, and forth to touch the gauge, and the readings are taken. The values
will vary because the robot is not a perfect device, and is prone to variations between motions.

12. The students will then ‘teach’ a set of points for pegs in the workcell (from set ‘p’ to set ‘q’,
using tool orientation ‘tool pegtool’). The points will then be used to run the ‘pegs’ program.
The students should notice failures to pick up pegs due to friction, positioning problems, etc. A
Short discussion follows. Different modes are used for teaching, ‘manual joint’, ‘manual cylin-
drical’, and ‘limp’.

13. A sheet of paper is taped down, and the robot is outfitted with a pen. Four points are then
taught to the gripper (point set ‘r’ and ‘tool weldtool’). The ‘weld’ program is then run, and the
robot traces out the path with straight line, and continuous motion. In both cases the paths are
not perfect, due to controller action. The program is run again to show the repeatability of the
process.
page 781

43. CNC MACHINES

• Computer Numerical Control machines use a computer to guide a process that might otherwise
be done manually.

43.1 MACHINE AXES

43.2 NUMERICAL CONTROL (NC)

• The use of numerical data to drive a machine for processes such as,
- milling
- turning
- drilling
- grinding
- shot peening
- tube bending
- flame cutting
- automated knitting machines
- automatic riveting
- etc.

• Basic components of NC systems,


- program
- controller unit
- machine tool

• Most suited to,


- parts are processed frequently in small lot sizes
- complex part geometry
- close tolerances on workpart
- many operations on part in processing
- large amounts of metal to be removed
- engineering design will possibly change
- parts that are too expensive for mistakes

• The methods for developing NC programs include,


- manual part programming
- computer-assisted part programming
- computer generated programs

• The manual and computer aided methods use various NC programming languages,
page 782

- APT (Automatically Programmed Tools)


- AUTOSPOT (Automatic System for Positioning Tools)
- SPLIT (Sundstrand Processing Language Internally Translated)
- COMPACT II
- ADAPT (ADaptation of APT)
- EXAPT (Extended Subset of APT)
- UNIAPT

• These languages are used by a parts programmer to define the motion of the cutting tool.

• The languages may be preprocessed, and then used for a number of various control types, such
as,
- punched paper tape
- Computer Numerical Control (CNC)
- Direct Numerical Control (DNC)

• The automatic methods work with geometry created in a CAD program.

43.2.1 NC Tapes

• NC Programs are preprocessed on computers, and punched onto paper or mylar tapes.

• Simple NC machines can use a tape reader to direct the machine.

• Problems,
- required storage, transportation, and manual loading of NC tapes
- has to reread the tape for each new part
- tapes tend to wear, and become dirty, thus causing misreadings
- the readers are slow, and can cause ‘dwell marks’ on complex pieces
- the mechanical parts in the readers reduced reliability
- testing had to be done on the NC machine
- no program editing abilities (increased lead time)

• The end of tapes was the result of two competing developments


- DNC used remote computers to replace tape readers, these were displaced in most cases
by CNC
- CNC allowed the use of a local computer to overcome problems with tapes, and the
problems with distant computers. While CNC was used to enhance tapes for a
while, they eventually allowed the use of other storage media, and currently pro-
gram transfer media are not required.
page 783

43.2.2 Computer Numerical Control (CNC)

• A computer controller is used to drive an NC machine directly.

• Characteristics are,
- controls a single machine
- located very close to machine tool
- allows storage/retrieval/entry of NC programs without preprocessing of NC code

• Advantages of CNC,
- program is only entered into memory once, so it is more reliable
- the programs can be tested and altered at the machine
- increased flexibility and control options on the local computer
- easy to integrate into FMS systems

• The Background,
- the problems with NC tapes were approached using DNC networks
- the communication problems with DNC systems became obvious, and local computers
were added to act as tape readers which would read tapes once, and play them back
to the NC machine indefinitely
- CNC controllers began using other storage media like magnetic tapes, and floppy disks
- CNC now offers features like,
- local programming,
- communication over interfaces,
- hard disk storage,
- program simulation
- etc.

• ASIDE: Direct Numerical Control is similar to CNC, except a remote computer is used to con-
trol a number of machines. This gives the advantage of more computer power. This approach is
no longer popular, as the dropping cost of computers offsets any advantages.

• Some companies use proprietary NC Languages, such as the example of DYNA Mill NC code
shown later

• These machines are often programmed by downloading NC code from a computer, or manually
programming the controller computer.

• Future trends involve,


- adaptive feed rates to increase speeds as the metal removal rate varies
- tool wear detection
-
page 784

43.2.3 Direct/Distributed Numerical Control (DNC)

• Uses a few methods,


- the oldest methods used modems, and a mainframe which emulated a tape reader, to con-
trol the NC machine (no storage)
- a more recent advance used a local computer which acts as a storage buffer. Programs are
downloaded from the main DNC computer, and then the local controller feeds
instructions to the hardwired NC machine, as if they have been read from tape.
- the newer methods use a central computer which communicates with local CNC comput-
ers (also called Direct Numerical Control)

• DNC controllers came before CNC machines, but as computer technology improved it became
practical to place a computer beside the NC machine, and DNC changed in form.

• Characteristics of modern DNC systems are,


- uses a server (with large storage capacity) to store a large number of part programs
- the server will download part programs on demand to local machines
- may have abilities to,
- display and edit part programs
- transmit operator instructions and other data needed at the machines
- collect and process machine status information for management purposes

• Advantages are,
- eliminates the need for NC tapes (the advantages are obvious)
- design changes are immediate
- NC programs may be edited quickly
- can be used to support an FMS system
- increase efficiency of individual machine tools
- more shop up-time than with stand alone machines
- simplifies implementation of group technology, computer aided process planning, and
other CIM concepts
- reduces peripheral costs with NC tapes

• A Brief History,
• Mid 60’s
- concept proved by Cincinnati Milacron and G.E.
- telephone links used to send instructions from large computers to hard wired NC
machines. Basically replaced a tape reader.
• 1970
- several commercial DNC systems announced.
• Mid 70’s
- Aerospace companies used DNC because of the large number of distributed
machines in their facilities.

• Initial resistance to DNC technology was (previously) based on,


page 785

- high cost of computer hardware


- the number of machines which could be controlled by one computer was limited
- computer software was limited for maintenance, scheduling, control, and data collection
- a backup computer was usually required
- was hard to justify on the basis of downloading parts programs

• when downloading programs there are two popular opinions,


- a program should only be downloaded in part, this accommodates easy engineering
changes in a real-time environment.
- many programs should be downloaded to the local controller to provide protection
against system failure, and eliminating the cost of real-time response in the DNC
central computer.

43.3 EXAMPLES OF EQUIPMENT

• The number of NC machines available commercially will be well into the thousands.

43.3.1 EMCO PC Turn 50

• This is a small desktop lathe capable of turning parts in metal.

• The basic physical specifications are,


page 786

Cutting Volume radial travel 48mm rad.


axial travel 228mm
Max. Holding Volume radial 30-65mm
axial 300mm
Max. Tool Size 12mm by 12mm
Chuck max 80mm dia.
Spindle 130-3000 rpm
Resolution 0.001mm
Feed 0-750 mm/min
Feed Force <=600N below 500mm/min
Power 100/110/230VAC, 0-6KVA
Dimensions 840 by 695 by 345 mm
Weight 85Kg
Controller FANUC (option)
Control Interface IBM compatible computer
Programming G-Codes and windows software

• The basic sequence of operations for this machine are,


1. Unpack components.
2. Connect devices to power, air supply, and attach interface cables.
3. Install RS-485 card in PC.
4. Install software.
5. Test basic system (Done initial setup here).
6. Start and initialize lathe and PC with software.
7. Setup tools for new job. Find zero positions/offsets, and enter values for turret.
8. Load NC code.
9. Simulate program.
10. Load stock and close automatic chuck.
11. Close door.
12. Run program on Lathe.
13. Open door and open chuck.
14. If cutting a similar part go to step 8, if doing a new setup go to step 7.

43.3.2 Light Machines Corp. proLIGHT Mill

• This is a small desktop lathe capable of turning parts in metal.


page 787

• The basic physical specifications are,

Cutting Volume

Max. Holding Volume

Max. Tool Size


Spindle 200-5000 rpm
Resolution
Feed 50ipm x,y and 40ipm z
Feed Force
Power
Dimensions
Weight
Controller IBM compatible computer
Control Interface IBM compatible computer
Programming G-Codes and Dos software
Spindle 1 H.P.

• The basic sequence of operations for this machine are,


1. Unpack components.
2. Connect devices to power, air supply, and attach interface cables.
3. Install software.
4. Test basic system (Done initial setup here).
5. Start and initialize mill and PC with software.
6. Setup tool for new job. Find zero position/offset.
7. Load NC code.
8. Simulate program.
9. Run program on Mill.
10. If cutting a similar part go to step 7, if doing a new setup go to step 6.
page 788

43.4 PRACTICE PROBLEMS

1.
page 789

44. CNC PROGRAMMING

• We need to be able to direct the position of the cutting tool. As the tool moves we will cut metal
(or perform other processes).

• Obviously if we plan to indicate positions we will need to coordinate systems.

• The coordinates are almost exclusively cartesian and the origin is on the workpiece.

• For a lathe, the infeed/radial axis is the x-axis, the carriage/length axis is the z-axis. There is no
need for a y-axis because the tool moves in a plane through the rotational center of the work.
Coordinates on the work piece shown below are relative to the work.

Head Tail Stock

WARNING: Be cautious, the x


z
axis is intuitively the radius
of the workpiece. But, many
systems use the dimension
x as a diameter. Make sure you
y know what the coordinate
values are for.

• For a tool with a vertical spindle the x-axis is the cross feed, the y-axis is the in-feed, and the z-
axis is parallel to the tool axis (perpendicular to the table). Coordinates on the work piece
shown below relative to the work.

z y

• For a tool with a horizontal spindle the x-axis is across the table, the y-axis is down, and the z-
page 790

axis is out. Coordinates on the work piece shown below relative to the work.

z
x

• Some common programming languages include, (note: standards are indicated with an *)
ADAPT - (ADaptation of APT) A subset of APT
*APT - (Automatically Programmed Tool) A geometry based language that is compiled
into an executable program.
AUTOSPOT - A 2D language developed by IBM. Later combined with ADAPT.
COMPACT/COMPACTII - A higher level language designed for geometrical definitions
of parts, but it doesn’t require compilation.
EXAPT - A european flavor of APT
*G-Codes (EIA RS-274 G&M codes)
MAPT - (Microcomputer APT) - Yet another version of APT
UNIAPT - APT controller for smaller computer systems
Other Proprietary languages

• These languages have many similarities, but the syntax varies.

44.1 G-CODES

• This language was originally designed to be read from paper tapes. As a result it is quite simple.

• The language directs tool motion with simple commands

• Note, I show programs with spaces to improve readability, but these are not necessary.

• A basic list of ‘G’ operation codes is given below. These direct motion of the tool.
G00 - Rapid move (not cutting)
G01 - Linear move
G02 - Clockwise circular motion
G03 - Counterclockwise circular motion
G04 - Dwell
page 791

G05 - Pause (for operator intervention)


G08 - Acceleration
G09 - Deceleration
G17 - x-y plane for circular interpolation
G18 - z-x plane for circular interpolation
G19 - y-z plane for circular interpolation
G20 - turning cycle or inch data specification
G21 - thread cutting cycle or metric data specification
G24 - face turning cycle
G25 - wait for input #1 to go low (Prolight Mill)
G26 - wait for input #1 to go high (Prolight Mill)
G28 - return to reference point
G29 - return from reference point
G31 - Stop on input (INROB1 is high) (Prolight Mill)
G33-35 - thread cutting functions (Emco Lathe)
G35 - wait for input #2 to go low (Prolight Mill)
G36 - wait for input #2 to go high (Prolight Mill)
G40 - cutter compensation cancel
G41 - cutter compensation to the left
G42 - cutter compensation to the right
G43 - tool length compensation, positive
G44 - tool length compensation, negative
G50 - Preset position
G70 - set inch based units or finishing cycle
G71 - set metric units or stock removal
G72 - indicate finishing cycle (EMCO Lathe)
G72 - 3D circular interpolation clockwise (Prolight Mill)
G73 - turning cycle contour (EMCO Lathe)
G73 - 3D circular interpolation counter clockwise (Prolight Mill)
G74 - facing cycle contour (Emco Lathe)
G74.1 - disable 360 deg arcs (Prolight Mill)
G75 - pattern repeating (Emco Lathe)
G75.1 - enable 360 degree arcs (Prolight Mill)
G76 - deep hole drilling, cut cycle in z-axis
G77 - cut-in cycle in x-axis
G78 - multiple threading cycle
G80 - fixed cycle cancel
G81-89 - fixed cycles specified by machine tool manufacturers
G81 - drilling cycle (Prolight Mill)
G82 - straight drilling cycle with dwell (Prolight Mill)
G83 - drilling cycle (EMCO Lathe)
G83 - peck drilling cycle (Prolight Mill)
G84 - taping cycle (EMCO Lathe)
G85 - reaming cycle (EMCO Lathe)
G85 - boring cycle (Prolight mill)
G86 - boring with spindle off and dwell cycle (Prolight Mill)
page 792

G89 - boring cycle with dwell (Prolight Mill)


G90 - absolute dimension program
G91 - incremental dimensions
G92 - Spindle speed limit
G93 - Coordinate system setting
G94 - Feed rate in ipm (EMCO Lathe)
G95 - Feed rate in ipr (EMCO Lathe)
G96 - Surface cutting speed (EMCO Lathe)
G97 - Rotational speed rpm (EMCO Lathe)
G98 - withdraw the tool to the starting point or feed per minute
G99 - withdraw the tool to a safe plane or feed per revolution
G101 - Spline interpolation (Prolight Mill)

• M-Codes control machine functions and these include,


M00 - program stop
M01 - optional stop using stop button
M02 - end of program
M03 - spindle on CW
M04 - spindle on CCW
M05 - spindle off
M06 - tool change
M07 - flood with coolant
M08 - mist with coolant
M08 - turn on accessory #1 (120VAC outlet) (Prolight Mill)
M09 - coolant off
M09 - turn off accessory #1 (120VAC outlet) (Prolight Mill)
M10 - turn on accessory #2 (120VAC outlet) (Prolight Mill)
M11 - turn off accessory #2 (120VAC outlet) (Prolight Mill) or tool change
M17 - subroutine end
M20 - tailstock back (EMCO Lathe)
M20 - Chain to next program (Prolight Mill)
M21 - tailstock forward (EMCO Lathe)
M22 - Write current position to data file (Prolight Mill)
M25 - open chuck (EMCO Lathe)
M25 - set output #1 off (Prolight Mill)
M26 - close chuck (EMCO Lathe)
M26 - set output #1 on (Prolight Mill)
M30 - end of tape (rewind)
M35 - set output #2 off (Prolight Mill)
M36 - set output #2 on (Prolight Mill)
M38 - put stepper motors on low power standby (Prolight Mill)
M47 - restart a program continuously, or a fixed number of times (Prolight Mill)
M71 - puff blowing on (EMCO Lathe)
M72 - puff blowing off (EMCO Lathe)
M96 - compensate for rounded external curves
M97 - compensate for sharp external curves
page 793

M98 - subprogram call


M99 - return from subprogram, jump instruction
M101 - move x-axis home (Prolight Mill)
M102 - move y-axis home (Prolight Mill)
M103 - move z-axis home (Prolight Mill)

• Other codes and keywords include,


Annn - an orientation, or second x-axis spline control point
Bnnn - an orientation, or second y-axis spline control point
Cnnn - an orientation, or second z-axis spline control point, or chamfer
Fnnn - a feed value (in ipm or m/s, not ipr), or thread pitch
Innn - x-axis center for circular interpolation, or first x-axis spline control point
Jnnn - y-axis center for circular interpolation, or first y-axis spline control point
Knnn - z-axis center for circular interpolation, or first z-axis spline control point
Lnnn - arc angle, loop counter and program cycle counter
Nnnn - a sequence/line number
Onnn - subprogram block number
Pnnn - subprogram reference number
Rnnn - a clearance plane for tool movement, or arc radius, or taper value
Qnnn - peck depth for pecking cycle
Snnn - cutting speed (rpm), spindle speed
Tnnn - a tool number
Unnn - relative motion in x
Vnnn - relative motion in y
Wnnn - relative motion in z
Xnnn - an x-axis value
Ynnn - a y-axis value
Znnn - a z-axis value
; - starts a comment (proLight Mill), or end of block (EMCO Lathe)

• The typical sequence of one of these programs is,


1. Introductory functions such as units, absolute coords. vs. relative coords., etc.
2. Define coordinates.
3. Feeds, speeds, etc.
4. Coolants, doors, etc.
5. Cutting tool movements and tool changes
6. Shutdown

• A program is given for the sample part below. Complete the last few lines.
page 794

7”
1” 1” 1” 1” 1”

Notes:
1. Drawing not to scale
2” 1.5”
2. NC origin set to bottom left
of both views
3” 3. the available tools are,
#1 5/8” dia. drill
3” #2 1/2” dia. mill
4. Speeds and feed have been
assumed.

.5”
y
2” 1.5”

x 2 holes 5/8”dia.
all rounds 1/4” rad.

.5”
1”
2”
z

x
N10 G70 G90 T01 M06 ; set to inches & absolute coords and tool #1
N20 G00 X1.000 Y2.000 Z2.200 ; move to above first hole
N30 F12.0 S480 M03 ; set speeds and feeds
N40 G81 Z-0.100 R2.200 ; drill first hole
N50 G81 Y4.000 Z-0.100 R2.200 ; drill second hole
N60 M05 T02 M06 F50 S2400 M03 ; change to milling cutter and set speeds and feeds
N70 G00 X3.500 Y-0.600 Z2.200 ; move toward long slot cut
N80 G00 Z1.000 ; move to right depth
N90 G01 Y7.200 ; cut slot length
N100 G00 X4.000 ; move to cut second pass
N110 G01 Y-7.200 ; cut second half of slot
N120 G00 X3.250 Y3.000 Z1.500 ; move to cut round
N130 G02 Y3.250 I3.000 J3.000 ; cut round
etc. ; you need to complete the part program

Note: The program above will cut the 1” slot too narrow. How can we fix that?
page 795

• The following is an example of circular interpolation. This is valid for both milling and turning.
Note that here we move to the start point, the command indicates the direction (clockwise or
counterclockwise). The I, J values indicate the center of rotation, and the X, Y values indicate
the point to stop at. We can also cut circular paths on other planes by resetting the cutting
planes (G17, G18, G19).

(2,5)
N10G01X6Y1; MOVE TO (6, 1)
N11G03X2Y5I2J1; CUT CIRCULAR PATH

(2, 1)

(6, 1)

(0, 0)

• When cutting, it is useful to change our point of reference. When doing mathematics we tend to
dimension relative to a main origin (absolute). In fact a machine will need to have coordinates
specified with reference to a main origin. But when we examine parts we tend to refer to local
origins for features. (Consider how you dimension details on a drawing.) These relative points
refer to as local origins. We can also do moves as distances to the next point.

(3, 3)
N0010G90 ; PUT IN ABSOLUTE MODE
N0011G01X1Y2 ; MOVE TO (1,2)
N0012G01X2Y2 ; MOVE TO (2,2)
N0013G91 ; PUT IN INCREMENTAL MODE (2, 2)
N0014G01X1 ; MOVE TO (3,2) (3, 2)
N0015G92X2Y2 ; SET NEW ORIGIN
N0016G01X1Y1 ; MOVE TO (3, 3) ABSOLUTE
N0017G92X0Y0Z0 ; RESET THE ZERO (1, 2)
(0, 0)

• When using the prolight mill we can add program elements to request that an external device (ie
robot) load or unload parts. We will assume that the robot has been connected to the robotic
interface port available. This port has four inputs and two outputs. The example below assumes
page 796

that the input #1 indicates a part has been dropped off and the mill can start. Output #1 will be
turned on to request that the robot pick up a part and load new stock.

N20M26 ; SEND OUTPUT TO REQUEST ROBOT LOAD A PART


N21G26 ; WAIT UNTIL THE INPUT FROM THE ROBOT INDICATES PART HERE
N22M25 ; TURN OFF REQUEST TO ROBOT
N23G00.... ; START CUTTING THE PART
........
N89G00..... ; END PART CUTTING
N90M26 ; SEND OUTPUT TO REQUEST PICKUP BY ROBOT, AND NEW PART
etc.....

• In previous examples we calculated the cutter offsets by hand. Modern NC machines keep a
record of the tool geometry. This can then be used to automatically calculate offsets (you don’t
need to put the tool size in the program).

• The best way to think of tool compensation is when cutting a profile, should we be to the left or
right of the line.

G42 G41
G00 X1.000 Y1.000 G00 X1.000 Y1.000
G01 Y2.000 G01 Y2.000
G01 X2.000 G01 X2.000
G01 Y1.000 G01 Y1.000
G01 X1.000 G01 X1.000

• In the previous example we notice how the shape is distorted by how the cutter navigates the
corners. There are additional commands to help with these problems.
page 797

M97 - compensate for corners larger M96 - compensate for corners


than step (requires more time)

G41 G41
G01 X4.000 G01 X4.000
G01 X1 Y1 M97 G01 X1 Y1 M96

• Typical commanded cycles include,


- rectangular pocket milling
- circular pocket milling
- slot or elongated hole milling
- peck drilling
- tapping

• For practice, develop the part program for the component shown below
page 798

y
5
P4
4

L3 L2
3

C1
2

P1
1

L1 P3 x
P2 1 2 3 4 5 6 7

44.2 APT

• This language allows tools to be programmed using geometrical shapes. This puts less burden
on the programmer to do calculations in their heads.

• APT programs must be converted into low level programs, such as G-codes.

• An example of an APT program is given below.


page 799

5 y

P4
4

L3 L2
3

C1
2

P1
1

L1 P3 x
P2 1 2 3 4 5 6 7
P0=POINT/0,-1.0,0
P1=POINT/6.0,1.125,0
P2=POINT/0,0,0
P3=POINT/6.0,0,0
P4=POINT/1.75,4.5,0
L1=LINE/P2,P3
C1=CIRCLE/CENTER,P1,RADIUS,1.125
L2=LINE/P4,LEFT,TANTO,C1
L3=LINE/P2,P4
PL1=PLANE/P2,P3,P4
FROM/P0
GO/TO,L1,TO,PL1,PAST,L3
GORGT/L1,TANTO,C1
GOFWD/C1,PAST,L2
GOFWDL2,PAST,L3
GOLFT/L3,PAST,L1
GOTO/P0

• Some samples of the geometrical and motion commands follow. These are not complete, but are
a reasonable subset.

• GEOMETRY: The simplest geometrical construction in APT is a point


p=POINT/x,y,z - a cartesian point
p=POINT/l1,l2 - intersection of two lines
p=POINT/c - the center of a circle
p=POINT/YLARGE,INTOF,l,c - the largest y intersection of a line and a circle
*Note: we can use YSMALL,XLARGE,XSMALL in place of YLARGE
page 800

• GEOMETRY: Lines are one of the next simplest definitions,


l=LINE/x1,y1,z1,x2,y2,z2 - endpoint cartesian components
l=LINE/p1,p2 - endpoints
l=LINE/p,PARLEL,l - a line through a point and parallel to another line
l=LINE/p,PERPTO,l - a line through a point and perpendicular to a line
l=LINE/p,LEFT,TANTO,c - a line from a point, to a left tangency point on a circle
l=LINE/p,RIGHT,TANTO,c - a line from a point, to a right tangency point on a circle
l=LINE/LEFT,TANTO,c1,LEFT,TANTO,c2 - defined by tangents to two circles
l=LINE/LEFT,TANTO,c1,RIGHT,TANTO,c2 - defined by tangents to two circles
l=LINE/RIGHT,TANTO,c1,LEFT,TANTO,c2 - defined by tangents to two circles
l=LINE/RIGHT,TANTO,c1,RIGHT,TANTO,c2 - defined by tangents to two circles

• GEOMETRY: Circles are very useful for constructing geometries


c=CIRCLE/x,y,z,r - a center and radius
c=CIRCLE/CENTER,p,RADIUS,r - a center point and a radius
c=CIRCLE/CENTER,p,TANTO,l - a center and a tangency to an outside line
c=CIRCLE/p1,p2,p3 - defined by three points on the circumference
c=CIRCLE/YLARGE,l1,YLARGE,l2,RADIUS,r - tangency to two lines and radius
*Note: we can use YSMALL,XLARGE,XSMALL in place of YLARGE

• GEOMETRY: More complex geometric constructions are possible


PLANE/ - defines a plane
QUADRIC/a,b,c,d,e,f,g,h,i,j - define a polynomial using values
GCONIC/a,b,c,d,e,f - define a conic by equation coefficients
LCONIC/p1,p2,... - defines a conic by lofting (splining) points
RLDSRF/ - a ruled surface made of two splines
POLCON/ - define a surface using cross sections
PATERN/ - will repeat a motion in a linear or circular array

• Once we have constructed points, lines and circles we can then proceed to direct the tool to fol-
low the path.

• MOTION: We can use the basic commands to follow the specified geometry
FROM/p - specify a start point
FROM/x,y,z - specify a start point
GOTO/p - move to a final point
GOTO/x,y,z - move to a final point
GOTO/TO,p - move until the tool touches a point
GOTO/TO,l - move until the tool touches a line
GOTO/TO,c - move until the tool touches a circle
GOLFT/l1,TO,l2 - go on the left of l1 until the tool touches l2
GORGT/l1,TO,l2 - go on the right of l1 until the tool touches l2
GOBACK/l1,TO,l2 - reverses direction along l1 to l2
GOBACK/l1,TO,c1 - reverses direction along l1 to c1
GOUP/l1,TO,l2 - goes up along l1 to l2
page 801

GODOWN/1l,TO,l2 - goes down along l1 to l2


GODLTA/x,y,z - does a relative move
Note: TO can be replaced with PAST, ON to change whether the tool goes past the struc-
ture, or the center stops on the structure.

• MOTION: The following commands will create complex motion of the tool
POCKET/ - will cut a pocket
PSIS/ - will call for the part surface

• As would be expected, we need to be able to issue commands to control the machine.

• CONTROL: The following instructions will control the machine outside the expected cutting
tool motion.
CUTTER/n1,n2 - defines diameter n1 and radius n2 of cutter
MACHIN/n,m - uses a post processor for machine ‘n’, and version ‘m’
COOL/ANT/n - either MIST, FLOOD or OFF
TURRET/n - sets tool turret to new position
TOLER/n - sets a tolerance band for cutting
FEDRAT/n - sets a feedrate n
SPINDL/n,CW - specifies n rpm and direction of spindle

• We can also include some program elements that are only used for programming

• PROGRAM: The following statements are programming support instructions


REMARK - starts a comment line that is not interpreted
$$ - also allows comments, but after other statements
NOPOST - turns off the post processor that would generate cutter paths
CLPRNT - prints a sequential history of the cutter center location
SQRTF(n) - calculates the floating point square root
FINI - stop program
PARTNO/n - allows the user to specify the part name
LOOPST and LOOPND - loop instructions
RESERV/n,m - defines an array of size ‘n’ by ‘m’
JUMPTO/n - jump to line number

• Note: variables can also be defined and basic mathematical operations can be performed.

• Note: macro functions are also available.

44.3 PROPRIETARY NC CODES


page 802

• NC code Example (for the Dyna Milling Machine)


000 START INS 01 Start Program in inches
001 TD = 0.125
Set Tool Diameter
002 FR XY = 10
003 FR Z = 4 Set Feed Rates
004 SETUP > zcxyu Set Absolute Zero Position
005 GO Y -.625
006 GO Z -.125 Move to Start Position
007 GR a -180 A
008 ZERO AT
009 X .634
010 Y .5 B
2.00”
011 GO r .125
012 a 90
013 GR a -30 B
014 > REF COODS 30°
Y
015 ZERO AT 0.50”
016 X 1.50 Z C
017 Y0 C X
018 GO r .125 D
019 a 60 0.50”
A
020 GR a -60
E
021 > REF COODS
F
022 ZERO AT
023 X 1.5
024 Y -0.3 0.20”R
D
025 GO r .125
026 a0
027 GR a -90 E
028 GR X -1.3 F
029 END
End Program

44.4 GRAPHICAL PART PROGRAMMING

• Basically,
1. Part geometry is entered in 2D or 3D.
2. Tool geometry and machine tool type are entered.
page 803

3. Speeds and feeds are entered or calculated based on tool and work material.
4. Inside/outside of geometry, and initial stock sizes are selected.
5. Cutter paths are generated.
6. Cutter paths are converted to a machine specific language (eg, G-codes).

• These programs are usually built into better CAD systems or are available as stand alone soft-
ware

• Some machine tools have these programmers built into the controller.

44.5 NC CUTTER PATHS

• When we have simple features, paths are easy to generate. These features include,
- steps
- pockets
- holes
- etc.

• Typically paths for these will repeat as shown below,

• For complex surfaces we want to contour appropriately. These surfaces will almost always be
represented with spline patches.
page 804

• Recall that a spline patch can be represented parametrically

(u=0,v=1) (u=1,v=1)

xp
p ( u, v ) = y p
zp

(u=0,v=0) (u=1,v=0)

• A simple algorithm to cut the surface is shown below.


page 805

dirn_flag = 1; a direction flag


n=10 ; number of passes to cut the surface
step=1.0/n ; step sizes for u and v directions
start=step/2 ; the start offset in the u and v directions
[xp,yp,zp] = p(start,start) ; calculate the start position
print(“G00 X”,xp,” Y”,yp,” Z”,zp+0.2) ; move the tool to above the start position
for i=0 to (n-1) ; will increment in the u direction
for j=0 to (n-1) ; will increment in the v direction
; calculate next point
if dirn_flag=-1 then [xp,yp,zp]=p(start+i*step,start+j*step)
if dirn_flag=1 then [xp,yp,zp]=p(start+i*step,start+(n-j)*step)
print(“G01 X”,xp,” Y”,yp,” Z”,zp) ; issue instruction to cut to next point
next j ; make next step in v direction until done
dirn_flag = -dirn_flag ; reverse direction to cut in opposite direction
next i ; move to next cut line in the u direction
print(“G00 Z”,zp+0.2) ; move the tool to above the end position

44.6 NC CONTROLLERS

• NC control programs are essentially quite simple. The source code for a basic controller is given
below.

********** Add in C-code for AMP project

44.7 PRACTICE PROBLEMS

1. Examine the part below. It is set up so that the origin is at the bottom left. The cutting tool has a
diameter of 1/2”, and the material is 1/8” thick.
page 806

T R2.000”

2.500”

2.000”

5.500” 2.000”

a) Write the equations needed to find the tangency point on the top left of the piece.

ans. 2 2 2
( x T – 5.5 ) + ( y T – 4.5 ) = 2

2 2 2 2 2 2
L AT = xT + yT = 2 + ( 5.5 + 4.5 )

b) Develop an NC program to mill the part. The program should be complete and include all
instructions required. If necessary, assume a location for the tangency point.

ans. N10 G70 G90 T01 M06


N20 F20 S2000 M03
N30 G00 X-0.0 Y-0.25
N40 G01 Z-0.25
N50 G01 X5.75
N60 G01 Y1.75
N70 G01 X7.75
N80 G01 Y4.5
N90 G02 X___ Y___ I5.5 J4.5
N100 G01 X___ Y-0.25
N110 G00 Z0.2
N120 M05 M00

2. Examine the part below. It is set up so that the origin is at the bottom left corner. The cutting
tool has a diameter of 1/2”, and the material is 1/8” thick. Develop an NC program to mill the part.
The program should be complete and include all instructions required.
page 807

T R2.000”

2.500”

2.000”

5.500” 2.000”

3.

You might also like