Professional Documents
Culture Documents
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.
email: jackh@gvsu.edu
phone: (616) 771-6755
fax: (616) 336-7215
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
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
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
• 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!
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.
• 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
• 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
- PLCs
- embedded controls
- PCs
- hardwired
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
• 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.
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 )
c G c ( B )G p ( B )
G dr ( B ) = ----n- = ----------------------------------------
rn 1 + G c ( B )G p ( B )
• It is possible (for a first order process) to match the output function to the input function in one
step.
cn = rn – 1 desired posn
cn
G dr ( B ) = ----- = B T
rn
actual posn
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.
• 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).
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
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 */
4.1.2.3 - Pascal
• The example program below should implement the deadbeat controller example given in this
section,
page 17
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 }
• The example program below should implement the deadbeat controller example given in this
section for a 6811 single chip microcontroller.
• 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
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
– ---
τ
B1 – e
cn (from transform table)
G dr = ----- = -------------------------
T
-
rn – ---
τ
1 – Be
actual
desired
Assuming the process model given below, find the general form for the control equation,
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
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.
• 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)
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
• 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.
• 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
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
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
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.
• 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.
• When a system has a disturbance that can be measured we can add a controller that specifically
compensates.
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 )
• 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.
• 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).
Gf
fn
+
+ en mn m′ n cn
Gc Gp
rn
+
-
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.
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
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
• 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.
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 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
desired
behavior
page 36
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.
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
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.
• 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
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
----
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
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
• 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 tank
• 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
• 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
Using all of the conditions outlined before, find out what happens when the valve
angle is changed to 10 degrees after 10 seconds.
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
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.
• 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
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.
• 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 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
• 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)
23
potentiometer
21 220
20
1uF
10K 10K
10K
19
-
+
motor
+5V 10K
10K
• Integral controllers tend to respond slowly at first, but over a long period of time they tend to
eliminate errors.
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
• 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.
Ko K o
–T -----
A
-
K i – T -----
A
- Ki
hn = hn – 1 e + θn – 1 – e
-----
- + ------
Ko K o
• 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.
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.
Ko K o
–T -----
A
-
K i – T -----
A
- Ki
hn = hn – 1 e + θn – 1 – e
-----
- + ------
Ko Ko
• 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
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
• Quite often the three constants are made the same, giving us the simpler equation below.
• This controller now allows us to vary the three different gains, and as a result we will change the
performance of the system.
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
• 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 )
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.
Controller Process
rn + en mn cn
Gc ( B ) Gp ( B )
-
page 58
yn = yn
y n – 1 = By n
2
yn – 2 = B yn
m
yn – m = B yn
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.
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
• 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 – Be
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
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
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
N Ns
K s = 2 ---- K d = 0.5 ------
m m
M=1kg y
• A quick look at how differential equations relate to difference equations will be useful.
Equation form,
y n – ay n – 1 = 0
General solution form,
1 –n
y n = C ---
a
–n –n –n
yn = C1 r1 + C2 r2 + … + Cm rm
• nonhomogeneous equations
page 67
Particular Solution
K K0
Kn K1 n + K 0
2 2
Kn K2 n + K 1 n + K 0
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.
• 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
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
What if?
y n = 2y n – 1 + 1.05x n – x n – 1
• 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
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
V
4
0 t (sec)
0 1 2 3 4 5
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
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
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
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
∴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
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
O n = -------------------------- -------------------2- S n
0.085B 0.005B
1 – 0.915B
(1 – B)
On → ∞ =
• 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.
er = rn – cn
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,
( 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
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.
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
+
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.
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.
6.1 INTRODUCTION
Transition - This will wait until all inputs have a token. Those tokens
are destroyed and new tokens are put into all the outputs
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 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.
and
exclusive or
regulator
or action
loop/repeat
if/wait
(state transition)
synchronize
• Reachability allows us to determine if a state (set of places) is possible given an initial condition.
• 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
money start
added cleaning
cleaning done
cleaning
off
drop cup
temp. sensor 3 sec delay
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
• 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
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
part entering
GRT CTD
source A C5:1.ACC C5:1
source B 0
CTU
C5:2
CTU
C5:7
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
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
• Control systems use some output state of a system and a desired state to make control decisions.
• 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)
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
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
• 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.
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
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
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
d- dx
---- →s ------ → sx
dt dt
1 x
∫ dt = ---
s ∫ xdt = --
s
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
θgas F 1- vactual
10 ------
Ms
5. Finally, knowing the error is verror, and we can control θgas (the control variable),
we can select a control system.
verror θgas
Controller
r c
G(s)
+
- r G(s) - c
--------------------------------
is equal to 1 + G ( s )H ( s )
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)
= 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 )
• 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
• Even though the transfer function uses the Laplace ‘s’, it is still a ratio of input to output.
vdesired
100 step
vdesired(t) = 100 for t >= 0 sec
ramp
vdesired(t) = 50t for t >= 0 sec
t(sec)
0
A
RAMP f ( t ) = Atu ( t ) f ( s ) = ----2
s
2
Aω
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,
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
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
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 )
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.
– 0.113t – 0.877t
v actual = 99.9 + 0.264e – 1.16e
• There are two very common systems assumed - first and second order.
• 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
-
+
+5V -5V
5K potentiometer
desired position
voltage Vd
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
- use the speed curve below from rest when 10V is applied
1400 RPM
1s 2s 3s
• 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.
e c
r
G
+
-
b
H
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
• 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
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
• 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.
+ 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
jω
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
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 )
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
jω
0 0
1 -1 σ
2 -2
3 -3
( 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 )
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)
σ
-2 -1
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.
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.
K( s + 5 )
G ( s )H ( s ) = ---------------------------------
2
s ( s + 4s + 8 )
• 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
+ +
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
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
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
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.
θ 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]
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
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)
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
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
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
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
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
• This methods has been applied to control of servo motors [Li and Lau, 1988].
8.2 REFERENCES
Li, Y.F., and Lau, C.C., “Application of Fuzzy Control for Servo Systems”, IEEE International
page 131
1. Two fuzzy rules, and the sets they use are given below. If verror = 30rps, and d/dtverror = 3rps/s,
find 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.2.1 Multiplexing
• 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.
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
• There are
10.1 CIRCUITS
10.2 FLUIDICS
10.3 PNEUMATICS
• There are
11.1 TYPES
• 68HC11
11.1.2 DSPs
11.1.3 CPUs
• 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 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.
• 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
• 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).
- 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
• 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.
• 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.
+V current flow
+V
Internal Card Electronics
+V power
NPN supply
NPN sensor -V
00 -V
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
+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
• These are fully solid state and are well suited to AC loads.
• At times we want to know when a physical object is present. This may involve touch.
• 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.
• At times we want to know when a physical object is present. This may be a non-contact detec-
tion.
page 144
• 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
• When the emitter and detector are separated and the beam is interrupted this is known as
opposed mode.
• When the emitter and detector are in a single unit this is known as retroreflective.
reflector
emitter
object
detector
emitter
object reflector
have filters for detector light reflected with
emitted light same polarity
rotated by 90 deg.
• 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.
• 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
distance 1 distance 2
lens
emitter
lens
detector 2
detector 1
• Typical reflectivity values are given below [Banner Handbook of Photoelectric Sensing]
Reflectivity
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
• 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
+V
electric
field
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 electrode
page 151
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
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
• These normally use frequencies above 20KHz which is above the normal human hearing thresh-
old of 16KHz.
• Good for sensing distances to most materials with surfaces perpendicular to the beam.
• As a result these sensors are designed to switch in the presence of a magnetic field.
• A specific fluid flow rate can be detected using a float in a tapered channel.
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
1. Given a clear plastic bottle, list 3 different types of sensors that could be used to detect it.
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.
6.
page 159
• 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.
• 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
+ 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).
+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
-
+
-
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
ELECTRICAL
Property Sensor Input operation typ. accuracy
TEMPERATURE
Property Sensor Input operation typ. accuracy
ATMOSPHERIC
Property Sensor Input operation typ. accuracy
FLUIDS
Property Sensor Input operation typ. accuracy
MATERIAL PROPERTIES
Property Sensor Input operation typ. accuracy
ELECTRONIC
Property Sensor Input operation typ. accuracy
SPATIAL (NEWTONIAN)
Property Sensor Input operation typ. accuracy
acceleration accelerometer
position transducer
velocity velocity pickup
SPATIAL (PRESENCE)
Property Sensor Input operation typ. accuracy
• 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
13.3.1 Potentiometers
• 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.
• How the openings are etched onto the disk determine whether it is absolute or relative.
page 168
relative
(quadrature) encoder absolute encoder
• 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
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.
1. What is the resolution of an absolute optical encoder that has six tracks? nine tracks? twelve
page 170
tracks?
13.4.1 Potentiometers
• 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
• 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.
• Near the center of the movement range the voltage is linearly proportional to core movement.
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
• 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
hookup wire
hookup wire
velocity pickup
stud
silicone
velocity pickup grease magnet
surface surface
page 174
13.5.2 Tachometers
• 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
13.6.1 Accelerometers
Sensor
Source of vibrations,
pre- or site for vibration
amp measurement
signal processor/
recorder
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
• The accelerometer is mounted with electrically isolated studs and washers, so that the sensor
may be grounded at the amplifier to reduce electrical noise.
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.
• There is often a trade-off between wide frequency range and device sensitivity (high sensitivity
requires greater mass)
• Mass of the accelerometers should be less than a tenth of the measurement mass.
• 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.
• These devices are attached to surfaces. As the surfaces experience stress/strain the devices are
stretched and the resistance changes.
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
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).
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
• 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
• 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
• 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.
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.
β --- – -----
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.
• Disadvantages include,
- smaller temperature range
- signal is not linear
- very wide resistance range
- self heating
13.10 SOUND
13.10.1 Microphones
• A microphone has a finite area to measure the sound with. As the diameter ‘d’ approaches the
wavelength of sound, the sound becomes distorted.
• When wind blows across a microphone, it generates a low frequency turbulence noise. This is
often corrected by using dBA measurements, and foam balls.
1
---
2
C TP = 10 log ------------------- ------ dB
460 + F 30
528 B
Barometric pressure (in Hg)
temperature (F)
correct level to measurement
• These devices change from high resistance (>Mohms) in the dark to low resistance (<Kohms) in
bright light.
V high
V out
V low
13.12 PRESSURE
• 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.
(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.
2. What is the relationship between Real Power, Reactive Power and Apparent Power? (A sketch
is acceptable)
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
• There are a wide range of actuators. Some require simple on/off control while others require
more sophisticated control.
• 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.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
Vac
load
PLC
controlled power
Von supply
TRIAC R
neut.
R < Von/I
15.1.1.1 - Relays
15.1.1.2 - Transistors
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.
• These are particularly bad electrically. There is a large actuation current and when deenergized
page 191
• A very popular application for solenoids is valves. These effectively use the solenoid to drive
pistons that open/close ports on a cylinder.
solenoid
solenoid
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.
• Typical hydraulic systems use a simple solenoid valve to actuate devices, some newer develop-
ments use more sensitive devices
15.2.3 Hydraulics
• Incompressible fluids are used to transmit volume and pressure changes throughout a system.
∆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.
• Oil Reservoir
page 194
air filter
access hatch
for cleaning
refill oil filter
level
gauge
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.
15.2.6 Others
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
• 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.
• 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
• 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
θ 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,
+ + -
+ Vu Ia T 1
Kd s + K p + ˆ + Ka Kt + -------
J 2
θr ( s ) - Js
θ(s
• 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
• 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.
• These motors do not provide much torque, but they are excellent for positioning applications.
page 200
torque
speed
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
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
• Considering their popularity, PLCs will be used as the basis for exploring discrete event control
systems.
• Advantages of PLCs,
- cost effective for complex systems
- flexible
- computational abilities
- trouble shooting aids
- reliable
• 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
00003 00004
END
page 205
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;
PROCESS
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.
THE
CONTROL
LOOP
process changes and PLC pauses
read inputs while it checks its own operation
• 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
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.
• 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.
• 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
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
• Contact coils are used to connect the PLC power lines to drive the outputs.
x
IIT
Develop a simple relay based controller so that three switches in a room could turn the
light on or off.
(ans. c)
201
100
101
(ans. d)
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)
(ans. b)
15.
page 215
• 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.
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.
• Input modules typically accept various inputs, depending upon specified values.
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 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.
• AC signals are more immune to noise than DC, so they are suited to long distances, and noisy
(magnetic) environments.
page 218
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
• WARNING - ALWAYS CHECK RATED VOLTAGES AND CURRENTS FOR PLC’s AND
NEVER EXCEED!
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
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
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
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
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
• 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).
1. TRUE / FALSE -- A PLC input can switch a relay coil to control a motor.
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.
(ans. c)
(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
8. Is AC or DC easier to interrupt?
12. What is the wiring difference between a sourcing and sourcing 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
• 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
• In fact the computer above looks more like the one below,
Disk Controller
• 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.
Self input logic output Self input logic output Self input logic
test scan solve scan test scan solve scan test scan solve
- 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.
• The PLC keeps track of its status, for internal use, as well as allowing use by the ladder logic.
ROM -
RAM -
EPROM -
EEROM -
FLASH RAM -
• Software based PLCs run on normal personal computers, but they use software that emulates
dedicated PLCs.
• 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.
• Many of the functions described in this note set support the standard.
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
• 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.
2. A PLC can only go through the ladder logic a few times per second. Why?
(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)
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
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
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.
e.g.
A=B*(C*(D+E+C)+F*C)
A = B * C ------------------------------------ Simplified Form
page 240
In ladder logic,
B1 B2 T1
F1
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
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 = BAC
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
D
E
F A
C
B
D C B A
B
C
D
A
B C D A
B C E
B C F
page 245
• 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.
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)
M S A
W S
W W (M+W) S * (M+W)
M = (S*W)+(S*M)
S A
M S A
W
page 247
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.
• Karnaugh maps allow us to convert a truth table to a simplified Boolean expression without hav-
ing to use Boolean Algebra.
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
• 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
• Recognizing certain logic forms allows faster identification and solution of design problems.
• These include,
- Comparitors
- Decoders
- Code conversion
- Adders/Subtractors
• 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
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
A1 A2 D1 X
A1 A2 D2
A1 A2 D3
A1 A2 D4
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
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
• 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.
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
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)
101 207
102
103
101 206
102 205
101 204
103
ETC....
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
((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)
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
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
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
A
B
C
X
B
A
ANS.
CAB
C
A X
B
A B C
X
b) OR
c) both a) and b)
d) none of the above
(ans. a)
a) (A + B) ⋅ ( A + B)
ans. ( A + B ) ⋅ ( A + B ) = ( AB ) ( AB ) = 0
a) A ( B + AB ) b) A ( B + AB )
c) A ( B + AB ) d) A ( B + AB )
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
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
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
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
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
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).
• For each base we count as usual, but the numbers stop at some value, then a more significant
digit is added.
21.2.1 Binary
• Binary is best used in computers because signals are ON/OFF which is well suited to the two
binary digits.
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
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
base 10 base 2
54,321
110000101101
BYTE WORD
MSB LSB MSB LSB
• 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
• 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.
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,
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.
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.
0100 1011
0100 1011
page 278
0100 1011
• 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
65
A W E E T E S T
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.
• 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
• Convert the decimal value below to a binary byte, and then determine the odd parity bit,
page 282
97
• 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.
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.
DATA CHECKSUM
124 505
43
255
9
27
47
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
1001111010011011
(ans. a. 3532 = 0011 0101 0011 0010 = DCC, b. the number is not a valid BCD)
(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?
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.1 INTRODUCTION
• 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.
Push Button
• Controls that have states, or time dependence will require temporal controls (also known as
sequential)
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
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
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.
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
22.2.3 Timers
on-delay off-delay
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
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
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
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
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
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.
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
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.
001 901
CTU
PR 0003
002 901
CTD
PR 0003
003 901
RST
901 111
001
002
003
901
111
count 5 button presses and then turn on a light. After ten button pushes the light will be
turned off.
• 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.
• 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.
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
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
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
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
On L
On TON T4:0
Time base: 1.0
Preset 20
T4:0/DN
Light L
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
• Design ladder logic that uses normal timers to measure times of 5.0 days.
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
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
T4:0/DN Light
Motor
T4:1/DN
T4:0 RES
T4:1/DN
T4:1 RES
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
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
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.
LS2
SOL1 U
T4:0/DN
T4:0/DN
LIGHT L
C5:0/DN
RESET
T4:0 RES
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.
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.
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
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
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.
10. The address for a memory location that indicates when a PLC has just been turned on is
___________________.
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
sequential
problem
simple/small complex/large
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?”
.... 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 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
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
• This method is not rigorous and can be inadequate for many designs.
• 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
START
no
start button pushed?
yes
yes
Open outlet valve
Is tank full?
Close inlet valve
no
no
• 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
MCR
page 329
START
F1
Reset all values off
F2
no
start button pushed?
yes
F3
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
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
• 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.
power on
• 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
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
make user
coffee button pushed choose
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.
A microwave oven.
page 338
• 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
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 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
first scan
yel. EW
yel. NS
delay 4sec
• 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.
• 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
MCR
868
701
L
702
U
703
U
704
U
MCR
page 342
701 012
702
704 013
703 014
703 015
704
702 016
701 112
MCR
701
701
101
U
702
101
L
MCR
page 343
702 MCR
901
RTO
PR 0040
901 702
U
901 703
L
901 901
RST
MCR
MCR
703
703
102
U
704
102
L
MCR
page 344
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
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.
• 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
ST4 timer on
T4:2
delay 4 sec
ST2 timer on
T4:1
delay 4 sec
ST1 ST1
ST1
ST4 T4:2/DN S1
first scan
S2
ST1 S1 S2 T4:1/DN
ST3 ST3
ST3
ST2 T4:1/DN S1
S2
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
STA
STB A B
STA B A C
STC D
FS
STC STC
STC
STB C A D
• 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
ST4 timer on
T4:2
delay 4 sec
ST2 timer on
T4:1
delay 4 sec
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
S1
S2
T4:1/DN
ST3
ST3 ST3
S1
S2
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
NOTE: The equations are shown here for illustration purposes, but this technique is not
suitable because of the parallel branches in the 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
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,
• Parallel Processes can happen separately but must eventually work together. This happens when
PLC’s control multistage machines, etc.
step
action
• 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
1 1
1st digit 1st digit
1st digit wrong 1st digit wrong
OK OK
2 2
5 relock#1
Parallel because things happen separately, but at same time (this can
also be done with state transition diagrams)
• SFCs can also be converted to ladder logic the same way state diagrams were.
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
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
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
• For practice,
page 370
Develop an SFC for a vending machine and expand it into ladder logic.
• Latches are one function built into PLCs, but there are variations.
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.
• These allow values to be put into a ‘pipe-line’ where values are shifted through one at a time.
page 372
shift
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
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
COM
rack 00
slot 1
button A + button B
motor on
door idle door opening
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
CTU
C5:0
preset 20000
C5:0/DN state 3
L
state 2
U
state 1
U
MCR
page 379
state 3
MCR
state 3
U
RES counter
MCR
motor = S1
light = S3
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
button
button
U door closing
bottom limit
U door closing
page 382
button
button
U door opening
top limit
T4:0/DN
garage light
ans.
b) block logic method door
closed remote OR button
(state 3)
remote OR button OR bottom limit
state 2
U
state 3
U
state 4
U
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
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
ST1 remote T1
button
ST2 remote T2
button
bottom limit
ST3 remote
T3
button
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 TOF
T4:0
preset 300s
ST4
T4:0/DN
garage light
page 388
ans.
d) SFC step 1
step 2
T1
button + remote
step 4
T4
button + remote
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
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
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
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
start
A on
yes
is B on?
no
A off
no
is C on?
yes
page 402
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
A
state 1 state 2
B
C
E
D
F
state 3
page 404
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
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
• 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.
• 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
Rack
I/O slot number in rack
• 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.
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
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
• 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
• 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
• 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.
• 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)
Design some simple ladder logic to turn on a light for the first 10 sec-
onds after a door is opened.
• 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
• 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.
• This memory can hold values from -32768 to +32767 - These values cannot be exceeded.
• These values are normally stored in N7:xx by default, but new blocks of integer memory are
page 412
• This can hold real values with fraction in the range of +/-1.1754944e-38 to +/-3.4028237e38.
• 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.
• Some handy functions found in PLC-5’s (similar functions are available in other PLC’s)
• 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
MOV
source 130
dest N7:0
MOV
source N7:1
dest N7:2
MVM
source N7:3
mask N7:4
dest N7:5
• 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
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
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
CPT
Dest. F8:0
Expression
SQR(LN(F8:1)+XPY(2.718,F8:2)*ACS(F8:3))
page 419
y + log ( y )
x = atan y ------------------------
y+1
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
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
• These functions act like input contacts. The equivalent to these functions are if-then statements
in traditional programming languages.
• 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
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
N7:0 1 0000000000000001
N7:1 5 0000000000000101
N7:2 11 0000000000001011
N7:3 15 0000000000001111
N7:4 0000000000001101
• These functions allow Boolean operations on numbers and values in the PLC memory.
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
• 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
• 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.
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,
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.
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.
0100 1011
• 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
• 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.
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
• 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
• 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.
I:000/00 5 R6:2/UL
BSR
File B3:1
Control R6:2
Bit address I:000/00
Length 5
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
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
• 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)
• 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
• MCR blocks have been used earlier, but they are worth mentioning again.
page 434
MCR
A
MCR
MCR
JMP
A B
JMP 01
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
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
• 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
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.
• 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
• 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 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
• 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
• 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.1 If-Then
A
JMP
LBL 01
A
JSR
FILE 3
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
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
• 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.
GENERAL FUNCTIONS
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
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
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
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
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
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
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
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
Registers: none
Available on: Micrologix, PLC-5
page 454
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).
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).
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”
Registers: none
Available on: PLC-5
LOGICAL
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.
Registers: none
Available on: Micrologix, PLC-5
CONVERSION
Registers: none
Available on: Micrologix, PLC-5
MOVE
page 459
Description: This function will copy the bits starting at N7:0/0 to N7:1/4 for a length
of 5 bits.
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.
Registers: none
Available on: Micrologix, PLC-5
page 460
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
Registers: cf cfvgfdg
DIAGNOSTIC
page 462
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
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
Registers: none
Available on: Micrologix, PLC-5
page 465
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
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
PID -
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg
Registers: cf cfvgfdg
BLOCK TRANSFER
page 469
BTW
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg
Registers: cf cfvgfdg
ASCII
page 470
AWT -
A TON
TIMER ON DELAY
Timer T4:0
Time Base 1.0
Preset 10
Accum. 0
Description: cfvgfdg
Registers: cf cfvgfdg
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
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
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.
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
• 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.
• Many of the functions described in this note set support the standard.
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
• 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.
• 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
N7:0 := 0
REPEAT
N7:0 := N7:0 + 1;
UNTIL N7:0 >= 10
END_REPEAT;
• These programs can also coexist with ladder logic programs. This gives the ability to get solu-
tions that are the best of both worlds.
• 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
Declaration Description
• Basic numbers are shown below. Note the underline ‘_’ can be ignored, it can be used to break
up long numbers, ie. 10_000 = 10000.
example description
• Date values are given below. These are meant to be used to compare to system time and date
clocks.
description examples
• 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
• 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.
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
Function Description
Write a structured text program to sort a set of ten integer numbers and then find the
median value.
....
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 *)
....
• 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
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
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.
• 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:
Program File 3:
6. Write the ladder diagram programs that correspond to the following Boolean programs.
page 499
• 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
N7:0 SIN
* A<B O:000/01
N7:1
LN
N7:2
• 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
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.
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.
A MN O
O := LIM(MN := A, IN := B, MX := C); LIM
B IN
C MX
• The tables of
1.
page 503
• Interfacing for Acquisition of Signals from Sensors and Generation of Signals for Actuators
• Computers are designed to handle both input and output (I/O) data
Voltage
analog
digital
• The computer uses approximation techniques to estimate the analog value during the sampling
window.
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
time
• 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
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
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
+
-
+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.
• To input analog values into a PLC we use the block transfer commands. These allow control
information to the input card and retrieve results.
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
T - input type - (0) gives single ended, (1) gives double ended
• 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
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
• 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.
5KΩ
10KΩ V– V ss
MSB bit 3 -
V +
20KΩ + +
bit 2
0
Computer Vo
40KΩ
bit 1
-
80KΩ
LSB bit 0
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.
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?
• To output a value we only need to write a single value to the output card
page 514
• 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
• 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.
• We can do SPC checking using analog inputs, and built in statistics functions.
X = ∑ Xj UCL = X + 3σ
X
j=1
LCL = X – 3σ
X
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
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
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
• 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.
q1
Main water
supply
q2
• 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.
room
upper temp. overshoot
temp.
limit
set temp.
(nominal)
lower
temp.
limit
time
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.
• Control systems use some output state of a system and a desired state to make control decisions.
• 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)
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)
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
• 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.
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
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 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.
• 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.
• 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.
Table 1:
Table 1:
• 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
-
• 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
• 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.
• 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
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
• 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
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
• 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
AWT
Channel 0
String Location ST9:0
Length 3
ST9:0 = ABC
• 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
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.
• 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
31.6.1 Introduction
...
- Shared Media
- Distributed Control
- No media sharing
- Central Control
page 543
• 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
Characteristics
HOST
N o. 3 H O ST
- Control token passed from
N o. 2
node to node
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.
• 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.
Layer Protocol
1 Physical Bit Physical
Interconnecting Medium
A Layer Interface
• Physical layer is concerned with transmission of raw bits over a physical circuit.
• Responsible for bit synchronization and the identification of a signal element as either a 0 or a 1.
• Data link layer breaks input data into “data frames” and processes acknowledgments.
• Responsible for the reliable delivery of information over a point-to-point or multipoint link.
• 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.
• Transport layer takes data from the session layer, splits it up if necessary, and passes this to the
network layer.
• Isolates the user from any concern for the actual movement of the information.
• Includes specification of the remote machine, authorization, options for the communication, and
recovering from errors in broken transport connections.
• Protocols: ISO 8327, CCITT X.225, T.62, ECMA 75, NFS, RPC.
• 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.
• 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.
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
IMP-IMP
Data Link Data link control Data link control
• 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
- etc
- Examples of this are NFS (Network File Server), SNMP (Simple Network Management
Protocol)
- Approximate costs >$1,000, unless provided with system
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
• Specialty buses,
- Genius I/O
- Sensoplex
page 555
31.7.1 Devicenet
• 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.
• 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
thin thin
trunk tap trunk thick trunk line
power tap
line line
terminator
terminator
drop
line flexIO
rack PC
tap
drop
line
power (24Vdc)
data
drain/shield
• Devices may have a red/green status light for the network status.
• On a PLC-5 rack you would need a devicenet interface and could use the instructions below.
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)
11 bits identifier
arbitration field
1 bit ready to receive it
1 bit ACK slot - other listeners turn this on to indicate frame received
31.7.3 Controlnet
• This is intended for communication between controllers, and permits more complex messages
than Devicenet.
page 559
31.7.4 Profibus
31.7.5 Ethernet
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).
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.
• 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.
• 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
Parts Pallet
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
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.
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.1 INTRODUCTION
• The basic purpose of an HMI is to allow easy graphical interface with a process.
• These allow an operator to use simple displays to determine machine condition and make simple
settings.
• 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
• Design an HMI for a press controller. The two will be connected by a Devicenet network.
page 568
1.
page 569
33.1 PROGRAMMING
• put each separate program in a separate program file, and give it its own section of memory to
avoid conflicts
• 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.
33.2 DOCUMENTATION
• 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
Start Date:
Contact Person:
PLC Model:
Attached Materials/Revisions:
Project Notes
Project ID: Date:
System Description Page of
I/O Notes
Power Notes Name:
Other Notes
page 573
Design Notes
Project ID: Date:
Application Notes
Project ID: Date:
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
Register or Word
Description
Internal Word
page 577
rung# comments
page 578
(ans. c)
2. TRUE / FALSE -- When planning Ladder Logic, the inputs/outputs should be chosen before
anything else.
(ans. true)
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
• 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
M
L1
M
motor
L2
3 phase
M AC
L3
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
Transformer
Start Overload
• 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
• 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 closed
normally open limit switch
limit switch breaker (3 phase AC)
thermal
overload relay fuse motor (3 phase AC)
temperature flow
normally open temperature flow normally closed
normally closed normally open
H1 H3 H2 H4
solenoid 2-position
hydraulic solenoid
page 586
Capacitor Battery
Variable Capacitor
Coil or Inductor
Common Coil with magnetic core
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.
COM I0
N0
+
I1
24VDC
- N1
I2
+ N2
12VDC
-
page 588
Preferred
device A device A
ground loop #1
device B device B
ground loop #2
-V
gnd
+V
+V -V
- 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.)
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.
• 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.
34.2 SAFETY
34.2.1 Troubleshooting
• 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.
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,
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
• Instrumentation Symbols,
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
X Unclassified Unclassified
Y Event, State or Presence Relay, Compute
Z Position, Dimen sion Driver, Actuator, Unclassified
Capillary Tube
Electric Signal
Hydraulic
Pneumatic
Process
FE
11 FE
11
orrifice plate
venturi or nozzle
EE FI
2 6
rotameter
magnetic
FV
11
control valve
35.1 REFERENCES
Paques, Joseph-Jean, “Basic Safety Rules for Using Programmable Controllers”, ISA Transac-
tions, Vol. 29, No. 2, 1990.
(ans. c)
2. Typically, programmable controller systems installed inside an enclosure can withstand a max-
imum of:
page 598
(ans. c)
(ans. c)
(ans. b)
(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
• Before a machine can be built, suitable components must be specified and ordered.
Project ID:
Name:
Date:
contacts
outputs
timers
counter
Total
page 601
Project ID:
Name:
Date:
TIME
MEMORY
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.
• 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.
• 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
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
• 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.
• 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.
• 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
• Servo control module - has an encoder and amplifier pair built in to the card.
• Ladder Logic is obvious, other standards are emerging, or are less common.
36.3 ISSUES
(ans. d)
2. TRUE or FALSE -- 1K is larger when speaking about memory than when speaking to commu-
nication speeds.
page 608
(ans. true)
(ans. b)
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.
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.
- 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
Data Interfacing/Networking
Discrete Sensors/Actuators
Implementation/Selection
Timers/Counters/Latches
Sequential Logic Design
Introduction/Overview
Advanced Functions
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
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.
<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.
100 105
200
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>
• 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
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.
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
y
P = ( x, y, z )
y
z x
z
page 623
θ3
θ2
θ1
• 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
• 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
One axis on
a surface
accuracy accuracy
control resolution
specified locations
• 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.
S U
σ
repeatability = ±r = 3s
accuracy = ( S – U ) + e
• 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.
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
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.
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
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
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
2 2 2
δ accuracy = ( ∑ δ xi ) + ( ∑ δ yi ) + ( ∑ δ zi )
Teach pendant
and/or
dumb terminal
Control
computer
PLC/NC
machine
memory
(battery Sensors
or eeprom)
CARTESIAN/RECTILINEAR/GANTRY
SPHERICAL
page 635
CYLINDRICAL
ARTICULATED/REVOLUTE/
JOINTED SPHERICAL
page 636
SCARA
• 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.
• These are typically wheeled robots that carry payloads through a factory.
• 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
R-axis (300mm)
Z-axis (120mm)
• Statements are ended with a colon, and as long as colons are used, more than one statement can
be used on a line.
• 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.
• 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
• 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).
• 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.
• 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.
CLEAR <variable> This will clear a variable or point value. If none is spec-
ified then all the variable memory is cleared.
HERE <Tn> Will define the current position to the location variable.
MOVEC <Tn> <Tn> [C] Move the robot in a circular continuous path
MOVEC <Tn> <rad> [L,C]
NOSHAVE Sets the robot to stop fully at the end of each motion.
SHAVE Allow the robot to start the next motion before the pre-
vious one is complete.
• 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
782mm
57mm
482mm
• Statements are ended with a colon, and as long as colons are used, more than one statement can
be used on a line.
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
• 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
• 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.
• 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
• 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.
• 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
• 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
• 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.
( 0, 650, 0 )
y
x
z
( – 650, 0, 0 )
( 650, 0, 0 )
page 655
• 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.
• 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.
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
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
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.
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.
• 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.
• 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
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.
• 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.
• 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.
• 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
39.3.4 Assembly
• These tasks are common, but face stiff competition from fixed automation and manual labor.
• 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.
• 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.
Part
robot arm
Gripper
- holding pressures/forces/etc are hard to control, try to hold parts with features or shapes
robot arm
Part
Gripper
- 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.
• 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.
• Typical mechanisms
- linkage actuation
- gear and rack
- cam
- screw
- rope and pulley
- miscellaneous - eg. bladder, diaphragm
page 670
• 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 force of a suction cup depends on the effective area of the vacuum and the difference in the
vacuum, and air pressures.
• 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.
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
• 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
• 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.
• 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
• Most grippers for manipulation are sold with mounts so that fingers may be removed, and
replaced.
• 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.
• The simulators available for the robots in the lab allow off-line programming and simulations.
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. 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.
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.
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
no start
button pushed?
yes
index pallet
no yes
is box full? stop pushed?
yes
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
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
no start
button pushed?
yes
index pallet
no yes
is box full? stop pushed?
yes
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
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?
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,
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.
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.
n
Global Path Time: T = S ˜ si˜ /˜ vi˜
i=1
n
Global Path Length: D = S ˜ si˜
i=1
n
page 693
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
si = ∅i, vi = ∅′i
ti = ∅i / ∅′i
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.
To compensate for the maximum torque here, an Inequalitry Constraint will be used, so that the
torque avoids approaching the maximum torque value.
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,
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.
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.
2D
2.5D 3D
3D Space 2D Approximation
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.
Goal
No Collision Avoidance
Start Collision
Goal
Start Collision
Goal
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
Approximated Volumes
(of lower arm and payload)
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.
goal
No Rotation
start
goal
Rotations at Points
rotation
point
start
goal
start
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.
Manipulator #1 Manipulator #2
Transfer
Point
World
Modeller
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.
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
Block =
Remove
Hole =
Bounding Boxes
Bounding Polyhedra
Separation Planes
goal goal
start start
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.
Goal
State Trajectory Motion
Path Manipulator
Planner Planner Controller
World
Modeller
A Priori Path A Postieri Path
World
Modeller
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.
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.
"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."
"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.
- maximum torques
- 2D mobile robots or 3D linked manipulators
- feasible trajectories
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
G G
Swept
S S Volume
G G
S S
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].
cone
spine
Start
As can be seen the rotation with this technique is very restricted, and the object is typically ori-
ented with the spine.
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.
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.
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.
Goal
Start
U G where:
U = Universe of Object and Obstacles,
A
B1
R = Configuration
B2 Space,
S
A
R G’
R G’
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
U G
A’
B1
B2
S
A
U G
A
Approximate object B1
with polygon which B2
covers all orientations. S
A
R G’
R G’
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.
-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.
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.
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
1 1
1
Maps to 1 1,2 2
2
3 3
3
3 3
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.
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.
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.
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.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, "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.
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.
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
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.
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.
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
E.Palma-Villalon, P.Dauchez, "World Representation and Path Planning for a Mobile Robot",
Robotica (1988), Volume 6, pp 35-40.
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.
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.
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
• 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.
• Positions can also be specified with respect to the robot base (Robot Coordinates), or globally
(World Coordinates).
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)
• Tool coordinates - determine where the tool is and what orientation it is in.
• 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)
• For simple manipulators (especially planar ones) this method is often very fast and efficient.
( θ 1, θ 2, … ) → ( x T, y T, z T, θ Tx, θT y, θ 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.
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
41.3 ACTUATORS
• There are a large number of power sources that may be used for robots.
- 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
• 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.
• 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.”
• 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
90
time(sec)
θ3
θ2
-90 θ1
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
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
• 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.
• 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.
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
• 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 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
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
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)
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.
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
ANS. d-
---- P ( t ) = 7.5
dt 3
c) Plot out the tool position, joint positions and velocities as functions of time.
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
• 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.
• When the robot motion is important (such as welding applications), the resolved rate method
may be useful
• The figure below shows an incremental interpolator, based on resolved rate motion control.
X'
J(θ)
• The figure below illustrates a system for making motions in cartesian space (straight line).
page 764
X d, X d', Xd''
θ d, θ d', θ d'' θ, θ', θ''
X, X', X''
forward
kinematics
• 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''
-
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.
θ desired
Start
digital
read position from sensor number voltage
θ actual = 36.0V actual A/D from sensor
(e.g. potentiometer)
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.
• 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
• 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.”
• 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?
90
time(sec)
θ3
θ2
-90 θ1
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
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.
• 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
• 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
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
• 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 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
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
• 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.
• 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.
42.4.2 Singularities
• A simple type of singularity often occurs at the edge of the robot workspace
• 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
θ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
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
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.
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.
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
• Computer Numerical Control machines use a computer to guide a process that might otherwise
be done manually.
• 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.
• The manual and computer aided methods use various NC programming languages,
page 782
• 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)
43.2.1 NC Tapes
• NC Programs are preprocessed on computers, and punched onto paper or mylar tapes.
• 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)
• 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.
• 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.
• 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.
• The number of NC machines available commercially will be well into the thousands.
Cutting Volume
1.
page 789
• 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).
• 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.
• 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
44.1 G-CODES
• This language was originally designed to be read from paper tapes. As a result it is quite simple.
• 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
• 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.
• 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
G41 G41
G01 X4.000 G01 X4.000
G01 X1 Y1 M97 G01 X1 Y1 M96
• 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.
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.
• 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
• MOTION: The following commands will create complex motion of the tool
POCKET/ - will cut a pocket
PSIS/ - will call for the part surface
• 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
• Note: variables can also be defined and basic mathematical operations can be performed.
• 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.
• When we have simple features, paths are easy to generate. These features include,
- steps
- pockets
- holes
- etc.
• For complex surfaces we want to contour appropriately. These surfaces will almost always be
represented with spline patches.
page 804
(u=0,v=1) (u=1,v=1)
xp
p ( u, v ) = y p
zp
(u=0,v=0) (u=1,v=0)
44.6 NC CONTROLLERS
• NC control programs are essentially quite simple. The source code for a basic controller is given
below.
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.
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.