How do I tune a pulse-and-direction stepper motor in closed-loop mode?

I'm asking in general, but in case it's relevant, my controller is a Turbo PMAC2 VME Ultralite, my motor driver is a Phytron ZMX+, and my encoder is a linear encoder.

On page 84 of the Turbo PMAC User Manual in the "Setting Up Turbo PMAC2 for Pulse-and-Direction Control" section, it says, "If using real feedback sensors, the motor should be tuned as a normal servo motor would be tuned."

However, my experience has been that this is not entirely true. The method I have followed involves using the PMAC Tuning Pro2 application to do interactive tuning with two trajectories: first the Position Step to tune Ixx30, Ixx31, and Ixx33, and then the Parabolic Velocity to tune Ixx32, Ixx35, and (maybe) Ixx68. An example of this method is shown in Delta Tau's "Motor Setup Tutorial, MOTOR TUNING EXAMPLE, DC BRUSHLESS MOTOR" video: https://www.youtube.com/watch?v=VUIOqdN8nX4. The Position Step trajectory for my stepper motor does not seem to behave like a servo motor at all.

The first difference I see for the Position Step move is with choosing the step size. The step size is supposed to be a half to a quarter of a revolution of the motor (for a rotary motor). In my case, the motor is a rotary motor, but the encoder is a linear encoder (i.e., there's encoder tape along the direction of travel); does that make a difference? I set the step size to 5000 which is half the number of encoder counts for one motor revolution. I left the step time at the default of 500 ms. 5000 counts / 500 ms = 10 counts/ms which is slower than the 50 counts/ms jog speed for this motor, so that should give plenty of time for the step move. I try running this move, and the motor doesn't move at all. I had to increase Kp (Ixx30) to 35 and decrease the step size to 2100 counts before it would move at all. So, this seems to not be anywhere near the same as a servo motor. What am I doing wrong?

The second difference I see for the Position Step move is that my stepper motor does not oscillate about the commanded position as I add Kp. A servo motor is supposed to oscillate about the commanded position as Kp is added, but my stepper motor doesn't oscillate at all. As I add Kp, the rise-time decreases and the steady-state error decreases. If I keep adding Kp, though, eventually the stepper motor doesn't move at all and sometimes emits an audible tone for the duration of the step move. So, this too seems to not be anywhere near the same as a servo motor. What am I doing wrong?

Is the Position Step move really appropriate for a pulse-and-direction stepper motor? If not, what is? How should the Ixx30, Ixx31, and Ixx33 gains be tuned?

I then tried the Parabolic Velocity move. This seemed to behave a bit more like a servo motor. So maybe this is still appropriate for a pulse-and-direction stepper motor?

As a final step in my Parabolic Velocity move tuning, I tried to add Kfff (Ixx68), but that didn't seem to work. I could set it to 1 which seemed like it may have helped a little, but adding more seemed to destabilize the system with the FE ending up as an inverse plot of the commanded velocity. So, even though the value range is supposed to be 0 to 32767, I could only set it to 1 before it would destabilize. This makes it feel like maybe this is not meant for a stepper motor?

(09-29-2017, 08:32 AM)jlmuir Wrote: As a final step in my Parabolic Velocity move tuning, I tried to add Kfff (Ixx68), but that didn't seem to work. I could set it to 1 which seemed like it may have helped a little, but adding more seemed to destabilize the system with the FE ending up as an inverse plot of the commanded velocity. So, even though the value range is supposed to be 0 to 32767, I could only set it to 1 before it would destabilize. This makes it feel like maybe this is not meant for a stepper motor?

On trying this again, I can't even set Kfff (Ixx68) = 1; even that causes the FE plot to be an inverse of the commanded velocity (well, roughly two horizontal lines that are the inverse of the commanded velocity).

I think your biggest issue is that you only have feedback on your linear load, so it is a very indirect measurement of what your motor is doing. You have brought all the imperfections of the coupling and rotary/linear conversion "inside" your feedback loop, which likely makes it very poorly behaved. If there is any backlash in the mechanism, you get "lost motion" of the motor that your linear scale does not detect. This type of system is very difficult to tune well (and would be even with a servo motor if you only had load feedback).

Some people with this type of system get better results closing the loop on the simulated feedback, and using the linear scale just for corrections

Nearly a year later. Perhaps I should come here more often.
We have many such systems working here at Diamond light source. ( 600 plus axes).
Tuning is the same , but different. One of the challenges is that stepper motors respond 'slower' than the servo loop of the delta tau, so what might just be normal stepper motor response can be made much worse by the 'tuning'. Similarly vibrations ( many of the above motors are only operating at 1000 steps per rev) cannot be tuned out. So what we have done in the vast majority of these cases is to add an exponential filter to the feedback. This then 'masks ' the vibrations and we can get on with normal but stepper motor specific tuning.
The high pitch whining you describe is a result of the motor stalling. The PMAC than responds to the unchanging encoder feedback by increasing the demand until eventually ( maybe only a few tens of milliseconds) this frequency is in the audible range. The current is still changing in the motor making the noise, but the rotor has long since given up.

As long as the motor resolution ( including any micro stepping you are using) is less than the encoder resolution ( by 2 or 4 :1 say) then you should get quite good results, unless of course ( as Curt mentions) the mechanics are introducing imperfections) . If you have spare encoder channels you could do a dual loop thing. Put the linear encoder in one channel, and use this as the position feedback, and then use the pulses as the velocity feedback. Again, when the mechanics have been sloppy we have done as Curt describes and used the pulses to give the feedback on one channel, and the encoder to do position corrections via another. In this instance our supervisory control system compares values at the end of a move and makes corrective moves if necessary. In this way we have more than doubled achievable speeds on some of our more troublesome axes.