I tried setting up closed-loop spindle control last night. It took me a while to figure out why it wasn't working (my encoder had lost the B channel) but during my investigations I found some interesting points.
The output of the Hostmot2 PWM block gives 100% duty cycle at +100% and -100% input, though it inverts the direction bit. This is, of course, perfectly sensible. The output of the PID hal component is limited to +/- maxoutput. The effect of this seems to be that if the spindle is faster than setpoint, the PID controller can wind down to the negative limit, which sets the PWM to 100%, which sets the spindle speed to max. One solution would be to wire the PWN direction pin to the spindle direction buttons, but this ia a VFD and that seems unwise. Curiously http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Closed_Loop_Spindle_Speed_Control seems to address this by using the PID block in a rather unusual way, adding the output of the PID block to the motion.spindle-speed-out pin, so that the output of the PID becomes a correction to the setpoint rather than the actual setpoint (which might explain why he suggests a PGain of zero). The other alternative would be to limit the output of the PID to zero before sending it to the PWM, but then it will tend to take some time to wind up from the negative limit to zero and that seems potentially troublesome. Which way is best? I am coming round to the idea that the documented solution (using motion,spindle-speed-out effectively as a precontroller and the PID as a tuning offset) actually makes a lot of sense, even if it does seem a little unconventional. I suspect it could still get "stuck" on its negative limit, though? -- atp ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
