I'm at a loss to understand what is going wrong and therefore other than randomly trying different parameter values I'm not really moving forward. What's happening is this on the 2.7.14 LinuxCNC system: I've set the PID with P=1.8 and I=1.0 using the PWM module on the 7i92H which is creating a 0-10V signal to rotate the spindle. Feedback is into the mesa encoder module with 60 slots per rev quadrature is 240 edges. If I enable the spindle button for clockwise and then click the '+' button the spindle starts at 101 RPM. As I recall when not using feedback the clicks would start at 1RPM so each click of the plus increments by 100RPM (the PID pulls it in pretty closely although the display oscillates around 101.9 to 99.1 RPM but mostly 100.xxx RPM. When I click the '-' with the RPM at 501 it drops to 401. Again and so on down to 101. The last click should take it down to 1 or 0 RPM. However that last click sends it to max speed of 3000 RPM. After that the clicks +/- don't do anything. Only the STOP buttons stops the spindle. It's like the PID has overflowed and after that can't fix itself. Also another clue. If I have it turning at say 2000 RPM and I click on stop and then on the clockwise button again before it's stopped it also takes off to 3000. I think it's like it sees too large an error and the negative value is turned into the absolute value rather than 0 to tell it to stop turning because the error is so large. Below is the spindle hal file information. Thanks John #******************* # SPINDLE S #******************* #=========================================================== # SPINDLE ENCODER # Hardware assumptions: # An encoder is connected to the spindle and puts out 60 pulses per revolution on phase A # The encoder A phase is connected to the DB25 #2 Pin 11 # The encoder A phase is connected to the DB25 #2 Pin 12 # The encoder index pulse is connected to DB25 #2 Pin 13 # ---Encoder feedback signals/setup--- setp hm2_7i92.0.encoder.01.counter-mode 0 setp hm2_7i92.0.encoder.01.filter 1 setp hm2_7i92.0.encoder.01.index-invert 1 setp hm2_7i92.0.encoder.01.index-mask 0 setp hm2_7i92.0.encoder.01.index-mask-invert 0 setp hm2_7i92.0.encoder.01.scale [SPINDLE_9]ENCODER_SCALE # couple the encoder output to the motion control system so it knows what the spindle is doing. net spindle-revs <= hm2_7i92.0.encoder.01.position net spindle-vel-fb-rps <= hm2_7i92.0.encoder.01.velocity net spindle-index-enable <=> hm2_7i92.0.encoder.01.index-enable # ---setup spindle control signals--- net spindle-index-enable <=> motion.spindle-index-enable net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs net spindle-vel-cmd-rpm <= motion.spindle-speed-out #net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs net spindle-enable <= motion.spindle-on net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net spindle-brake <= motion.spindle-brake net spindle-revs => motion.spindle-revs # ---Setup spindle at speed signals--- # Use ACTUAL spindle velocity from spindle encoder # spindle-velocity bounces around so we filter it with lowpass # spindle-velocity is signed so we use absolute component to remove sign # ACTUAL velocity is in RPS not RPM so we scale it. # Filter uneven encoder signals with low pass filer. setp scale.spindle.gain 60 setp lowpass.spindle.gain 0.005 net spindle-vel-fb-rps => lowpass.spindle.in net spindle-vel-fb-rps-filtered <= lowpass.spindle.out # Pass filtered rps to spindle net spindle-vel-fb-rps-filtered => motion.spindle-speed-in # create absolute value so RPS is unsigned net spindle-vel-fb-rps-filtered => abs.spindle.in net spindle-vel-fb-rps-abs <= abs.spindle.out # Convert RPS to RPM net spindle-vel-fb-rps-abs => scale.spindle.in net spindle-vel-fb-rpm-abs <= scale.spindle.out #===================================================== # SPINDLE RAMP control -- Open loop with no encoder feedback. # set the parameter for max rate-of-change # (max spindle accel/decel in units per second) setp spindle-ramp.maxv 10 # hijack the spindle-speed-out and send it to spindle-ramp.in net spindle-cmd <= motion.spindle-speed-out-rps => spindle-ramp.in # Grab the output of the ramp component. This is what changes slowly net spindle-ramped <= spindle-ramp.out #===================================================== # SPINDLE PID control setp pid.s.Pgain [SPINDLE_9]P setp pid.s.Igain [SPINDLE_9]I setp pid.s.Dgain [SPINDLE_9]D setp pid.s.bias [SPINDLE_9]BIAS setp pid.s.FF0 [SPINDLE_9]FF0 setp pid.s.FF1 [SPINDLE_9]FF1 setp pid.s.FF2 [SPINDLE_9]FF2 setp pid.s.deadband [SPINDLE_9]DEADBAND setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT setp pid.s.error-previous-target true #setp pid.s.maxerror .0005 net spindle-index-enable <=> pid.s.index-enable net spindle-enable => pid.s.enable net spindle-vel-cmd-rps-abs => pid.s.command net spindle-vel-fb-rps-abs => pid.s.feedback net spindle-PID-output <= pid.s.output #===================================================== # SPINDLE Step Gen signals/setup setp hm2_7i92.0.stepgen.05.dirsetup [SPINDLE_9]DIRSETUP setp hm2_7i92.0.stepgen.05.dirhold [SPINDLE_9]DIRHOLD setp hm2_7i92.0.stepgen.05.steplen [SPINDLE_9]STEPLEN setp hm2_7i92.0.stepgen.05.stepspace [SPINDLE_9]STEPSPACE setp hm2_7i92.0.stepgen.05.position-scale [SPINDLE_9]STEP_SCALE setp hm2_7i92.0.stepgen.05.step_type 0 setp hm2_7i92.0.stepgen.05.control-type 1 setp hm2_7i92.0.stepgen.05.maxaccel [SPINDLE_9]MAX_ACCELERATION setp hm2_7i92.0.stepgen.05.maxvel [SPINDLE_9]MAX_VELOCITY net spindle-enable => hm2_7i92.0.stepgen.05.enable # Don't use ramping when using PID. #net spindle-ramped => hm2_7i92.0.stepgen.05.velocity-cmd net spindle-PID-output => hm2_7i92.0.stepgen.05.velocity-cmd # ---closedloop stepper signals--- #net s-pos-cmd <= axis.9.motor-pos-cmd #net s-vel-cmd <= axis.9.joint-vel-cmd #net s-output => hm2_7i92.0.stepgen.05.velocity-cmd #net s-pos-fb <= hm2_7i92.0.stepgen.05.position-fb #net s-pos-fb => axis.9.motor-pos-fb #net s-enable <= axis.9.amp-enable-out #net s-enable => hm2_7i92.0.stepgen.05.enable #******************* # PWM gen signals/setup #******************* # PWM signal pin config setp hm2_7i92.0.pwmgen.00.output-type 1 setp hm2_7i92.0.pwmgen.00.scale [SPINDLE_9]PWM_SCALE setp hm2_7i92.0.pwmgen.pwm_frequency 1000 net spindle-enable => hm2_7i92.0.pwmgen.00.enable # Don't use ramped when using PID #net spindle-ramped => hm2_7i92.0.pwmgen.00.value net spindle-PID-output => hm2_7i92.0.pwmgen.00.value # PWM dir pin config setp hm2_7i92.0.gpio.005.is_output true net spindle-ccw => hm2_7i92.0.gpio.005.out #************************************* # ---Setup spindle at speed signals--- #************************************* # to know when to star0t the motion we send the near component # (named spindle-near-speed) to the spindle commanded speed from # the signal spindle-ramped output and the encoder reported spindle speed setp spindle-near-speed.difference 0.1 net spindle-vel-fb-rps-abs => spindle-near-speed.in1 # Use ramped #net spindle-ramped => spindle-near-speed.in2 #if Don't use ramped net spindle-cmd => spindle-near-speed.in2 # the output from spindle-at-speed 'near' component is sent to motion.spindle-at-speed # and when this is true motion will start. # The LED in the pyvcp-panel.xml is renamed to be a LED. net spindle-at-speed-led <= spindle-near-speed.out => motion.spindle-at-speed
_______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users