Chapter 3: DSPpro Controller Design
11
Vn = Vn-1 + FS * An
An is the acceleration at sample n
Xn = Xn-1 + FS * Vn
Vn is the velocity at sample n
Xn is the command position at sample n
FS is the feed speed
The command velocity is the rate of change of the command position, acceleration is the rate of
change of the command velocity, and jerk is the rate of change of the command acceleration.
3.2.4 Check for Event Triggers
The DSP checks an axis’ positive limit input, negative limit input, home input, amp fault input,
and software position limits. Also, the DSP checks the axis for time limits, position triggers, and
I/O triggers to determine if a new frame is to be executed.
3.2.5 Perform Event Actions
If an event trigger exists for an axis, the DSP performs the associated event. The possible events
are: Abort Event (highest priority), E-Stop Event, Stop Event, or New Frame Event (lowest
priority).
3.2.6 Calculate and Set DAC Output
The DSP calculates an axis’ output (analog voltage or pulse rate) based on a PID servo control
algorithm. The input to the PID algorithm is the current position error. The current position
error equals the difference between the command position and the actual position. The actual
position is controlled by the feedback device, and command position is controlled by the
trajectory calculator. The PID algorithm is based on the following formula:
On = K
R
( Kp*En + Kd*(En - En-1) + Ki*Sn + Kv*Vn + 64*Ka*An + Kf * Mn) + Ko
The subscripted n represents the sample period. The terms are defined:
Sn = Sn-1 + En if -Smax < Sn < Smax
Smax if Sn > Smax
-Smax if Sn < -Smax
On = DAC output
K
R
= overall scale factor
Kp = proportional gain
Kd = derivative gain
Ki = integral gain
Kv = velocity feed-forward
Ka = acceleration feed-forward
Ko = static DAC offset
Kf = friction feed-forward
En = position error
Mn = 0 or 1 based on the command velocity Vn = command velocity
An = command acceleration
Sn = integrated error
Smax = maximum integrated error
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com