Technical Reference
Motion Programming
12
www.galilmc.com / Galil Motion Control, Inc.
Record Data Mode
Controllers can record motion data at a fixed rate and store the data
in an array.This data can be later used to duplicate the motion or to
analyze it.
The recording process includes several steps. First the array
where the data is stored must be specified; later the type of data,
such as position, position error, etc. must be defined before the
actual recording is accomplished at a specified rate.The process is
illustrated by the following example.
The example below illustrates how recorded data can be used for
analysis.
Write a program to record the position error of the Y axis every 16 msec.
a total of 100 times and store the results in the array YERROR.
The actual recording is done with the instruction RC that has two
parameters: the recording time interval (2
n
msec) and the number of
recorded points.
INSTRUCTION
INTERPRETATION
#RECORD
Label
DM YERROR [100
Dimension array
RA YERROR []
Specify record mode
RD _TEY
Data type for record
RC 4,100
Actual recording
EN
End program
Example--Record Data Mode
Use the position error data collected in the previous example to per-
form a statistical analysis on the position error of Y. Determine the
maximum and the minimum values as well as the mean square value.
The following program performs the required tasks and stores the
results under the variables MAX, MIN, and MEAN.
INSTRUCTION
INTERPRETATION
#STAT
Label
N = 0
Initial values
MAX = 0
MIN = 0
SUM = 0
#LOOP
Label
E = YERROR [N]
Read position error
IF (YERROR [N] >MAX)
MAX = E
ELSE; IF (YERROR [N] <MIN)
MIN = E
ENDIF; ENDIF
SUM = E*E+SUM
Compute sum of squares
N = N+1
Increment index
JP#LOOP, N<100
Repeat 100 times
MEAN = SUM/100
Mean square
ROOT = @ SQR[MEAN]
Root mean square (RMS)
EN
End program
Example--Statistical Analysis