Datasheet
DMC60C™ Software Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 5 of 16
1.2.4 PID Tuning
There are two PID slots on the DMC60C. These can be configured separately and selected in software by calling
SetPIDSlot(0 or 1).
• P Gain - The proportional gain constant. This constant is used during closed loop control to calculate a
proportional increase or decrease in the throttle (duty cycle) due to the measured closed loop error. This
value is used when driving the motor in one of the closed loop control modes (Velocity, Position, or
Current).
• I Gain - The integral gain constant. This constant is used during closed loop control to calculate an integral
increase or decrease in the throttle (duty cycle) due to the measured closed loop error. This value is used
when driving the motor in one of the closed loop control modes (Velocity, Position, or Current).
• D Gain - The derivative gain constant. This constant is used during closed loop control to calculate a
derivative increase or decrease in the throttle (duty cycle) due to the measured closed loop error. This
value is used when driving the motor in one of the closed loop control modes (Velocity, Position, or
Current).
• Feed Forward Gain - The feed forward gain constant. This constant is used during closed loop control to
calculate the number of throttle units to contribute to the duty cycle as the proportion of the setpoint
(target Velocity, Position, or Current) independent of the error. For example, if the target current is 20.0
amps and you want to apply 50% throttle for this setpoint then the feed forward gain would be set to
. Convert this to fixed-point by multiplying by 65536. This results in a value of
0x03332CCC (hex), which is what should be sent to the DMC60C in the value field of the PARAMSET
packet. The feed-forward term can be excluded from the PID calculations by specifying a value of 0 for the
gain. This value is used when driving the motor in one of the closed loop control modes (Velocity,
Position, or Current).
• I Zone - The integral accumulator limit. This is used to limit how large the integral accumulator can grow
during closed loop control. The value sent to the DMC60C is converted to a 32-bit signed integer and used
to set the positive and negative bounds of the integral accumulator. If the integral accumulator exceeds
these bounds while PID calculations are performed, then the accumulator will be capped to IZone or -
IZone. This provides a mechanism for combating integral windup. Setting a value of 0 will disable the limit
and allow the integral accumulator to grow without bounds.
• Ramp Rate - The closed loop ramp rate. This specifies the maximum number of throttle units the output
can change by each time the control loop executes in closed loop control mode (Velocity, Position, or
Current). For example, If the closed loop ramp rate is set to 1000 and the PID update function determines
that the throttle should be increased by 5000 units then the immediate throttle increase will be limited to
1000 units. If the next PID Update doesn’t change the target throttle output value, the throttle will be
increased by another 1000 units the next time the control loop executes. This process will continue until
the target throttle is reached or a new throttle value is calculated. The control loop executes once every
500 µs. Therefore, specifying a closed loop ramp rate of 16 would result in it taking approximately 1.02
seconds to go from 0% throttle (0) to 100% throttle (32767). Specifying a value of 0 for the closed loop
ramp rate disables throttling and allows the output to be immediately set to the target value.
• Allowable Error - The allowable closed loop error. This specifies the minimum error required for the PID
controller to calculate a non-zero contribution to the output throttle based on the P, I, and D, terms. If the
allowable error is set to a non-zero value and the measured error is less than the allowable error then the
P, I, and D terms will contribute 0 throttle units to the output throttle calculation and the integral
accumulator will be cleared. If the allowable error is set to 0 or the measured error exceeds the allowable
error then P, I, and D terms are included in the output throttle calculation. The feed-forward gain
constant, or F term, is included in the output throttle calculation regardless of the allowable error setting.