`
`OF
`
`MOTION CONTROL SYSTEMS
`
`© 1994
`
`Jacob Tal
`
`All rights reserved
`
`No part of this book
`may be reproduced by any means,
`nor transmitted, nor translated
`without written permission from the author.
`
`Galil Motion Control, Inc.
`
`203 Ravendale Drive
`Mountain View, CA 94043
`
`Telephone
`Fax
`
`4115-9674700
`415~967—l750
`
`
`
`
`
`ABB Inc.
`ABB Inc.
`
`EXHIBIT 1017
`
`EXHIBIT 1017
`
`Page 1 of 23
`Page 1 of 23
`
`
`
`9. INTRODUCTION TO MOTION PROGRAMMING
`
`The previous chapters dealt with the fundamental questions of how to select
`
`the right components for the system and how to use them correctly. Special
`
`emphasis was placed on the subject of system stability, quick response, and
`
`accuracy.
`
`•
`The second part of the book focuses on progranuning the motion. Here we
`
`assume that the control system is indeed stable and that the motor position
`
`follows the commanded trajectory. The emphasis now is on commanding the
`
`appropriate trajectory that results in the required motion.
`
`It was indicated previously that the generation of motion consists of two
`
`major parts: generating the required profile and following it. The first part of
`
`the book deals with forcing the motor to follow the required trajectory. The
`
`second part deals with generating the profile.
`
`Chapter 10 starts with a description of general programming tools. Chapters
`
`11 and 12 discuss two special modes of motion: coordinated motion and
`
`contouring. Chapters 13, 14, and 15 deal with special motion types known as
`
`electronic gearing, tension control, and dual-loop control.
`
`The discussion presented here is general in nature and the design methods
`
`apply to most motion controllers. However, in order to provide specific
`
`illustrations and examples, we describe the implementation of the motion
`
`programming with the language used by Galil controllers.
`
`9-97
`
`Page 2 of 23
`
`
`
`10. l\10TION PROGRAMl\1ING TOOLS
`
`a
`
`can
`
`as building <JA'Vv4UJ
`
`Independent lVlotion Commands
`
`can
`
`a
`
`move
`
`TIME
`
`1
`
`Page 3 of 23
`
`
`
`I nstructioo
`PR 4000
`SP 20000
`AC 200000
`DC 200000
`BGX
`
`Interpretatioo
`Relative distance
`Speed rate
`Acceleration rate
`Deceleratiop rate
`Start motion of X motor
`
`The host computer sends the characters indicated by the program
`
`shown above and the motion starts immediately.
`
`Another type of simple motion is the jog move. Here the motor is
`
`commanded to run indefinitely at a specified speed. The motion parameters
`
`in this case are limited to the speed, acceleration, and deceleration. These
`
`parameters can be expressed in units of resolution as illustrated below.
`
`Example 10.2
`
`Instruction
`JG 40000
`AC 400000
`BGX
`
`Interpretation
`Jog speed
`Acceleration rate
`Start X motion
`
`The generation of more complex moves is described in the follOwing
`
`chapters.
`
`StoredPrograIDS
`The instructions for perfonning the motion can be issued directly from the
`
`host computer, resulting in an immediate move. This mode, the immediate
`
`mode, requires the continuous involvement of the host computer. An
`
`10-99
`
`Page 4 of 23
`
`
`
`alternative approach is the use of stored programs that reduce the involvement
`
`of the host computer.
`
`In this method the host computer downloads the motion program to the
`
`controller memory. To start the motion , the host sends a short command ,
`
`,'iu ch as ''t:xecute Program A." The controller will then receive the
`
`instructions from its memory without the interventi on of the host computer.
`
`To illustrate the concept. consider the move described in Example 1 0.1. To
`
`perfornl the same move from a stored program, the host modifies the progranl
`
`hy adding a laheL #A. for example, and an end stateme nt. EN. The resulting
`
`program is as follows:
`
`Example 10.3
`
`Instruction
`#A
`PR 4000
`SP 20000
`AC 200000
`DC 200000
`BGX
`EN
`
`Interpretation
`Program label
`Distance
`Speed
`Acceleration
`Deceleration
`Start X motion
`End of program
`
`The host ciov.nloads this program Il) the controller memory. whL're thL'
`
`prugrarn rClll(llilS in~l c {i\L' . Tu execute the program. tIll' hust sends tl1l'
`
`('()mlnand
`
`XQ#A
`
`I i i 11111
`
`Page 5 of 23
`
`
`
`which causes the controller to execute the program.
`
`Control Variables
`
`Variables allow the motion controller to perfonn certain mathematical
`
`functions and to make decisions accordingly. This capability increases the
`
`intelligence of the motion controller and allows it to perfonn some
`
`supervisory functions in addition to the simple motion control.
`
`A variable can be defmed as a constant or can be equated to a controller
`
`parameter. For example, the instruction
`
`sets the value of the variable V to 3. The instruction
`
`P= TPX
`
`reads the position of the X motor and equates the variable P to that value.
`
`Variables can be defined in a variety of ways. For example, the instructions
`
`YERROR = TEY
`
`equates the variable YERROR to the position error of the Y motor.
`
`10-101
`
`Page 6 of 23
`
`
`
`Once the variable is defined , it can be used in mathemat ical operations.
`
`Motion controllers can perfonn mathematical functions that typically include
`
`j ~.
`
`algebraic, trigonometric, and logic operations .
`
`When the mathematical operation is completed, the controller can use the
`
`computation result to adjust the system parameters. For exampJc. till' results
`
`can be used to change the speed , set the distance, or change the filter gain.
`
`The lise of variables is best illustrated by the following example.
`
`: .
`
`i
`i
`-' .
`
`~." .. ,;:
`
`~·I·; .. ;·· "'
`t; r
`
`.,
`. . ~ '
`
`Example 10.4
`
`Wlite a control1er-level program that detennines the maximum
`
`acceleration/deceleration rates that the motor can follow. To detelllline
`
`the limit , drive the motor repeatedly, and gradually increase the
`
`acceleration rate. The increased acceleration results in larger motor
`
`command signals. Once the controller output reaches saturation. we
`
`conclude that the maximum acceleration rate is exceeded.
`
`For a specific program, suppose we command tile motor to 1l10Vl' a
`
`distance of 10,000 counts and we increase the acee leration from the
`starting valUl' of 10.000 counts/s 2. We conclude that the cOJ)\rolln is
`
`saturated if till' uutplit signal is greater thall l))~V /"or thrl'l' l'() n";l'Cl!li\~'
`
`read ing..;,
`
`!I I III .'
`
`Page 7 of 23
`
`
`
`TIME
`Figure 10.2: Velocity Profiles with Increasing
`AccelerationlDeceleration Rates
`
`The resulting velocity profile is shown in Figure 10.2. We start with
`
`curve (a) and increase the acceleration/deceleration, leading to curves
`
`(b) and (c). The flowchart of the program is shown in Figure 10.3.
`
`INITIAL CONDITIONS
`A-10000
`FLAG-O
`
`DIST-10000
`SPEED-A
`ACCEL-A
`ST ART MOTION
`SET FLAG-1 IF OUTPUT
`IS SATURATED
`
`YES
`
`A-Al1.05
`
`MAX ACCEL.
`
`Figure 10.3: Aowchart for Example 10.4
`
`10-103
`
`Page 8 of 23
`
`
`
`The actual program consists of two parts. The first part, #MOVE,
`
`perfonns the move repeatedly while increasing the parameter A by 5%
`
`each time. A is used as both the acceleration and deceleration rate.
`
`The second program, #TEST, tests for saturation. It monitors the
`
`controller outputs and checks for three consecutive tests where the
`
`magnitude of the controller output exceeds 9.8V.
`
`The specific programs are shown below. Note that the test program
`
`sets the FLAG variable to 1 when saturation is detected. The #MOVE
`
`program repeats the motion as long as the parameter FLAG is zero.
`
`The two programs run simultaneously.
`
`Instruction
`Interpretation
`#MOVE
`Label
`Initial value of acceleration
`A=100000
`XQ#TEST,1
`Run program #TEST in multitasking
`Label
`#LOOP1
`Distance
`PR 10000
`Speed
`SP 1000000
`Acceleration
`ACA
`Deceleration
`DCA
`Start motion of X motor
`BGX
`Wait for end of motion
`AMX
`Increase A by 5%
`A=A*1.05
`Wait 1 sec between moves
`WT 1000
`JP#LOOP1. FLAG = 0 Repeat if not saturated
`Restore previous value
`A=A/1.05
`A=
`Report A value
`EN
`End program
`#TEST
`Label
`
`I () 11 11
`
`Page 9 of 23
`
`
`
`FLAG = 0
`N=O
`#LOOP2
`M=@ABSLTIX]
`JP#TEST, M<9.8
`N = N+1
`JP#LOOP2, N<3
`FLAG = 1
`EN
`
`Initial value
`Initial count
`Label
`Magnitude of output
`Start if not saturated
`Count up if saturated
`Repeat test 3 times
`Set FLAG to 1
`End test
`
`Input/Output Interface
`
`Motion controllers can read some input signals, both digital and analog, and
`
`cah generate some digital output signals. This enables motion controllers to
`
`control a complete process rather than be limited to the motion control
`
`function.
`
`Input signals, both digital and analog, can be read by the controller and their
`
`values can be stored in control variables. These variables can be used later in
`
`motion programs. The reading of digital inputs can be perfonned with the
`
`instruction
`
`DIGITAL = @ IN[21
`
`which reads the digital input #2 and stores its content, 0 or I, in the variable
`
`DIGITAL. Analog signals are similarly read with the instruction
`
`ANALOG = @ AN[3]
`
`The generation of digital output signals is perfonned by setting or clearing a
`
`bit with the instructions
`
`Page 10 of 23
`
`
`
`SB3
`CB3
`
`which sets and clears output bit #3.
`
`The interface with the inputs and the generation of the output signals allow
`
`the controller to perfonn complete process control without a host computer
`
`intervention. This is illustrated by the following example.
`
`Example 10.5
`
`Design a control system that controls the velocity of an XY table
`
`acording to the analog voltages generated by an XY joystick. The
`
`polarity and the magnitude of the motor velocities are detennined by
`
`the corresponding potentiometer voltage.
`
`Suppose, for example, that the required· speed is 10,000 counts/s for
`
`every volt of input signal. The resulting program reduces to reading
`
`the voltage of the two analog input signals, multiplying both results by
`
`10,000, and adjusting the speeds of the X and Y motors accordingly.
`
`The program flowchart is given in Figure 10.4 and the instructions are
`
`shown below.
`
`lostruQiion
`#TABLE
`AC 1 00000,1 00000
`DC 100000,1 00000
`JG 0,0
`BGXY
`#LOOP
`VX = @ AN [1]*10000
`
`Interpretation
`Label
`Acceleration rates
`Deceleration rates
`Set in jog mode
`Start motion
`Label
`Compute X velocity
`
`10·106
`
`Page 11 of 23
`
`
`
`VY = @ AN [2)*10000
`JG VX,VY
`JP#LOOP
`EN
`
`Compute Y velocity
`Update velocity
`Repeat the process
`End
`
`SET SYSTEM IN JOG
`
`MODE WITH ZERO
`
`INITIAL CONDITIONS
`
`LOOP 11<'<-----------.
`
`READ TWO ANALOG SIGNALS
`
`MULTIPLY THE VOLTAGES
`
`BY 10,000
`
`UPDATE THE SPEEDS
`
`Figure 10.4: flowchart for Example 10.5
`
`Reading the analog input signals is beneficial in force control systems
`
`because the force feedback is analog. To illustrate this process, consider the
`
`following example.
`
`Example 10.6
`
`Drive the X motor against a slowly moving target and maintain a
`
`constant force between the two elements. The contact force is
`
`1()"107
`
`Page 12 of 23
`
`
`
`measured by a load cell whose output is applied to analog input #1 .
`
`Assume that the desired force level corresponds to a signal level of 5V
`
`and that forward motion increases the tension between the two
`
`elements.
`
`The simplest control procedure is to run the motor in the jog mode
`
`where the motor runs ' continuously at a specified speed. The controller
`
`reads the analog signal to determine the force level and sets the speed
`of the motor in proportions with the error in the force level. The
`flowchart is shown in Figure 10.5. The program is shown below.
`
`~ ,\:. ' :.< '
`..
`DRIVE X MOTOR IN JOG
`
`MODE WITH ZERO INITIAL
`
`SPEED
`
`LOOP J(:-v _______ - . . ,
`''-
`
`REAO THE~N"~OG, SIGNAL
`
`COMPUTE THE TENSION
`
`EFiROR.ER
`
`~ET ~6W ~PEeO-1oq-ER
`
`Figure 10.5: Flowchart for Example 10.6
`
`to-lOS
`
`Page 13 of 23
`
`
`
`Instruction
`#FORCE
`AC 100000
`DC 100000
`JG 0
`BGX
`#LOOP
`ER = 5 - @AN [11
`VEL = ER*100
`JGVEL
`JP#LOOP
`EN
`
`Interpretatioo
`Label
`Acceleratioo rate·
`Deceleration rate
`Set jog mode
`Start motion
`Label
`Measure error in force level
`Set velocity
`Update velocity
`Repeat the process
`End
`
`Trippoints
`
`Motion control programs often include several functions. These functions are
`
`scheduled by delaying the execution of each function until a certain condition
`
`occurs. These conditions are called trippoints.
`
`For example, the "after distance" (AD) trippoint delays the execution of a
`
`function until after the motor moves a certain distance. Similarly, the
`
`execution of a function may be delayed until a move has been completed
`
`(AM), an input signal changes states (An, or by a pure time delay (WT).
`
`The following example illustrates the use of trippoints in executing a motion
`
`cycle.
`
`Example 10.7
`
`Consider the motion cycle illustrated by Figure 10.6. A forward
`
`motion of 10,000 counts must start upon a start pulse on input # 1. The
`
`10-109
`
`Page 14 of 23
`
`
`
`initial velocity, acceleration, and deceleration rates equal 20,000,
`
`100,000, and 100,000 respectively.
`
`INPUT 1
`
`20000
`
`VELOCITY
`
`10000
`
`n
`
`TIME
`
`Figure 10.6: Motion Cycle of Example 10.7
`
`· 20000
`
`Mter the motor has moved a distance of 6000 counts, the controller
`
`starts a deceleration toward a speed of 10,000 counts/so That speed is
`
`maintained for the rest of the move. Upon completion of the motion,
`
`the controller waits lOOms before returning the motor to the starting
`
`position, at a speed of 20,000 counts/so Once there, the controller is
`
`ready to repeat the cycle.
`
`Notice that the scheduling of the various functions requires the use of
`
`trippoints. The start of the motion is delayed by the trippoint AI I .
`
`When the motion starts, the velocity change is scheduled with the
`
`10· II 0
`
`Page 15 of 23
`
`
`
`trippoint AD 6000. The controller must then wait until the completion
`
`of the move (AMX) and adds a pure delay of lOOms (WT 1 (0) before
`
`returning the motor to the starting position. The resulting flowchart is
`
`shown in Figure 10.7, and the Instruction Program follows.
`
`CYCLE ::::
`
`DISTANCE=10000
`
`SPEED ... 20000
`
`WAIT FOR INPUT 1
`
`START THE MOTION
`
`AFTER A DISTANCE
`
`OF 6000 COUNTS
`
`"
`
`SPEED=10000
`
`WHEN MOTION IS COMPLETE
`
`WAIT 100 ms
`
`MOVE BACK 10000
`
`AT SPEED 20000
`
`WHEN MOTION IS COMPLETE
`
`Figure 10.7: Aowchart for Example 10.7
`
`Instructioo
`#CYCLE
`PR 10000
`SP 20000
`AC 100000
`
`Interpretation
`Label
`Distance
`Initial speed
`Acceleration rate
`
`10-111
`
`Page 16 of 23
`
`
`
`DC 100000
`AI1
`BGX
`AD 6000
`SP 10000
`AMX
`WT 100
`PR -10000
`SP 20000
`BGX
`AMX
`JP#CYCLE
`EN
`
`Deceleration rate
`Wait for start pulse
`Start motion
`Wait until X moves 6000 counts
`Change the speed
`Wait for completion of move
`Wait 100 ms
`Reverse motion
`Return speed
`Start motion
`Wait for end of motion
`Repeat the cycle
`End
`
`Arrays
`
`Arrays are structured memories where data can be stored and retrieved in a
`
`certain order. They are useful for storing sequences of position points or
`
`output signals.
`
`An array is characterized by a name and a size. Each element in the array is
`
`identified by its index. For example, the array XPOS may have a size of 100
`
`units. As a consequence, each point is identified as XPOS [N] where N
`
`varies between 0 and 99.
`
`To store data in the array, we use an instruction such as
`
`XPOS [5] = _ TPX
`
`which reads the current position of the X axis and stores the value in the
`
`array. The value of the position may be retrieved later with instructions of the
`
`foml
`
`10-112
`
`Page 17 of 23
`
`
`
`x = XPOS [51
`which transfers the position value to' the variable x.
`
`The use of arrays is illustrated by the folloWing example.
`
`The controller is required to mOve an XV 'fable to four positions
`characterized by their coordinates. Thevafues'offue"required points
`are stored in the arrays XPOS ;atid'mS. once the controller reaches
`the specified point, it must walt a ceitaiU amo~t'ofti.me before
`resuming, the motion. The waiting time in milliseconds is stored in the
`array WAIT.
`
`The program is described, in two parts. The first part, #STORE,
`
`defmes the arrays. The second part, RUN, performs the moves
`
`according to the requirements. The flowchart is given in Figure 10.8
`
`and the programs follow.
`
`One of the main uses of the array is for recording motion as described in the
`
`following section.
`
`1()"113
`
`Page 18 of 23
`
`
`
`1
`
`j
`
`SET X-V SPEED, ACCEL
`
`AND DECEL
`
`---- ------------------ - -' - - - --
`
`--
`
`-l
`
`READ XPOS[NJ,YPOS[N]
`
`COMMAND X-V MOTION
`
`WAIT FOR END OF MOTION
`
`WAIT THE REQUIRED T IME
`
`-----
`
`--
`
`--- -- - . - - - - - - - - - - '
`
`YES
`
`Figure 1 O.R: Flowchart for Example 10.R
`
`Interpretation
`Label
`Define arrays
`Set values
`
`Instruction
`#STORE
`OM XPOS [4]. YPOS [4], WAIT [4]
`XPOS [0] = 100
`XPOS [1 J = 320
`XPOS [2J = 450
`XPOS [3J = 500
`YPOS [0) == -100
`
`1 () 1 14
`
`Page 19 of 23
`
`
`
`YPOS [1] = 20
`YPOS [2] = 153
`YPOS [31 = 200
`WAIT [01 = 50
`WAIT [1] = 100
`WAIT [2] = 60
`WAIT [3] = 120
`EN
`
`I nstructjon
`#RUN
`AC 200000,200000
`DC 200000,200000
`SP 50000,50000
`N=O
`#LOOP
`PA XPOS [N), YPOS [N]
`BGXY
`AMXY
`wrWAIT [N]
`N = N+1
`JP#LOOP, N<4
`EN
`
`End of program
`
`Intemretatjon
`Label
`Accelerations
`Decelerations
`Speeds
`Initial count .
`
`",
`
`specify ' final position
`Start motion
`Wait for completion
`Wait specified time interval
`InGrement ind~x
`Repeat four times
`End of program
`
`Record
`
`Controllers may record motion data at a fixed rate and store the data in an
`
`array. 1bis data can be used later to duplicate the motion or to analyze it.
`
`The recording process includes several steps. First the array where the data
`
`are stored must be specified, and later the type of data, such as position,
`
`position error. etc., must be defined before the actual recording is
`
`10-115
`
`Page 20 of 23
`
`
`
`'".. '
`
`-
`~
`
`~'f"': ..
`~
`
`""r ... , \ - ., _ a';:'
`~ .
`.
`
`~
`
`accomplished at a specified rate. The process is illustrated by the following
`
`example.
`
`Example 10.9
`
`Write a program that records the position error of the Y axis every 16
`ms, a total of 100 times, and stores the results in the array YERROR.
`
`The actual recording is done with the instruction RC that has two
`
`parameters: the first parameter, n, defines the recording time interval
`
`as 2" ms. In the given example, n = 4 results in 16 ms intervals. The
`
`second parameter sets the number of the recorded points.
`
`Instryction
`#RECORD
`RA YERROR [100]
`RD _TEY
`RC 4,100
`EN
`
`Interpretation
`Label
`Storage array
`Data type
`Actual recording
`End
`
`The following example illustrates how recorded data can be used for analysis.
`
`Example 10.10
`
`Use the position error data collected in Example 10.9 to perform a
`statistical analysis on the position error of Y. Detennine the maximum
`and minimum values as well as the root mean square value. The
`
`following program performs the required tasks and stores the results
`
`under the variables MAX, MIN, and RMS. The program flowchart is
`
`shown in Figure 10.9.
`
`10-116
`
`Page 21 of 23
`
`
`
`N~ " MAX-O
`MIN-O SUM-O
`
`REA,q,DATA POINT E
`
`MIN-E
`
`SUM.E·E+SUM
`N-N+1
`
`YES
`
`RMS- V SUMl100
`
`Figure 10.9: Aowchart for Example 10.10
`
`Instruction
`#STAT
`N=O
`MAX = 0
`MIN = 0
`SUM-O
`#LooP
`E = YERROR [N]
`
`Interpretation
`Label
`Initial values
`
`Label
`Read position error
`
`1()"111
`
`Page 22 of 23
`
`
`
`JP#MAX, E<MAX
`MAX= E
`#MAX
`JP#MIN, E >MIN
`MIN = E
`#MIN
`SUM = E*E+SUM
`N = N+1
`JP#LOOP, N<100
`MEAN = SUM/1 00
`RMS=@SQR[MEAN]
`EN
`
`Compare with MAX
`Redefine MAX
`Label
`Compare with MIN
`Redefine MIN
`Label
`Compute sum of squares
`Increment index
`Repeat 100 times
`Mean square
`Root mean square
`End of program
`
`The programming tools described above are used to generate motion
`
`programs as shown in the following chapters.
`
`l(ll IX
`
`Page 23 of 23
`
`