Current turning capabilities status
26 Feb 2013 07:56 #30584
by andypugh
Replied by andypugh on topic Current turning capabilities status
I made a start on this, but need to know how you control the spindle direction.
Please Log in or Create an account to join the conversation.
26 Feb 2013 14:26 #30594
by emcPT
Replied by emcPT on topic Current turning capabilities status
Currently I am controlling the spindle using an analog output from the 7i33 (0-10V) with direction from the 7i37.
I have an quadrature encoder 1000ppr in the spindle back with index going straight to the 7i33. Encoder is working and apparent real speed is received.
I think it is the most common setup for linuxcnc users.
If any more information is needed please inform.
I have an quadrature encoder 1000ppr in the spindle back with index going straight to the 7i33. Encoder is working and apparent real speed is received.
I think it is the most common setup for linuxcnc users.
If any more information is needed please inform.
Please Log in or Create an account to join the conversation.
26 Feb 2013 17:34 #30607
by andypugh
can you tell me the HAL pin names for the fwd and reverse pins on the 7i37?
Replied by andypugh on topic Current turning capabilities status
Currently I am controlling the spindle using an analog output from the 7i33 (0-10V) with direction from the 7i37.
I have an quadrature encoder 1000ppr in the spindle back with index going straight to the 7i33.
can you tell me the HAL pin names for the fwd and reverse pins on the 7i37?
Please Log in or Create an account to join the conversation.
26 Feb 2013 17:59 #30608
by emcPT
Replied by emcPT on topic Current turning capabilities status
Here they are
# --- SPINDLE-CW ---
setp hm2_5i20.0.gpio.046.is_output true
net spindle-cw hm2_5i20.0.gpio.046.out
setp hm2_5i20.0.gpio.046.invert_output true
# --- SPINDLE-CCW ---
setp hm2_5i20.0.gpio.047.is_output true
net spindle-ccw hm2_5i20.0.gpio.047.out
setp hm2_5i20.0.gpio.047.invert_output true
# --- SPINDLE-CW ---
setp hm2_5i20.0.gpio.046.is_output true
net spindle-cw hm2_5i20.0.gpio.046.out
setp hm2_5i20.0.gpio.046.invert_output true
# --- SPINDLE-CCW ---
setp hm2_5i20.0.gpio.047.is_output true
net spindle-ccw hm2_5i20.0.gpio.047.out
setp hm2_5i20.0.gpio.047.invert_output true
Please Log in or Create an account to join the conversation.
27 Feb 2013 06:30 #30637
by andypugh
Replied by andypugh on topic Current turning capabilities status
I am not going to get round to this today. Sorry.
I had the feeling that you wanted the C-axis working too, is that right?
I had the feeling that you wanted the C-axis working too, is that right?
Please Log in or Create an account to join the conversation.
27 Feb 2013 14:36 #30644
by emcPT
Replied by emcPT on topic Current turning capabilities status
No problem, thank you.
I do not need the C axis at least for now. I would be happy only to know that the spindle speed is in fact controlled by the closed loop. Because if this works then I will probably buy the 15Kw inverter (now I am using a 5.5Kw with limited acceleration and deceleration for it not to trip).
Cheers.
I do not need the C axis at least for now. I would be happy only to know that the spindle speed is in fact controlled by the closed loop. Because if this works then I will probably buy the 15Kw inverter (now I am using a 5.5Kw with limited acceleration and deceleration for it not to trip).
Cheers.
Please Log in or Create an account to join the conversation.
27 Feb 2013 21:25 - 27 Feb 2013 21:27 #30649
by andypugh
Replied by andypugh on topic Current turning capabilities status
I think that this is what you need for simple PID control.
I haven't checked this, (at all) so be careful.
I haven't checked this, (at all) so be careful.
#*******************
# SPINDLE S
#*******************
# ---PWM Generator signals/setup---
setp hm2_5i20.0.pwmgen.03.output-type 1
setp hm2_5i20.0.pwmgen.03.scale [SPINDLE_9]OUTPUT_SCALE
# ---Encoder feedback signals/setup---
setp hm2_5i20.0.encoder.03.counter-mode 0
setp hm2_5i20.0.encoder.03.filter 1
setp hm2_5i20.0.encoder.03.index-invert 0
setp hm2_5i20.0.encoder.03.index-mask 0
setp hm2_5i20.0.encoder.03.index-mask-invert 0
setp hm2_5i20.0.encoder.03.scale [SPINDLE_9]ENCODER_SCALE
net spindle-revs <= hm2_5i20.0.encoder.03.position motion.spindle-revs
net spindle-index-enable <=> hm2_5i20.0.encoder.03.index-enable <=>motion.spindle-index-enable
net spindle-vel-fb-rps hm2_5i20.0.encoder.03.velocity => motion.spindle-speed-in
#PID for spindle
#Need to add FF0, PGAIN, IGAIN to your [SPINDLE_9] section
#Set [SPINDLE_9]OUTPUT_SCALE to 1. That job is now done by the PID FF0
#Set FF0 to give the closest speed-match at mid-speed
#then adjust P and I to suit.
loadrt pid names=spindle_pid
# using names= means that 2-pass HAL can work.
# alternatively increment the count in the HAL file.
addf spindle_pid servo-thread
setp spindle_pid.Pgain [SPINDLE_9]PGAIN
setp spindle_pid.Igain [SPINDLE_9]IGAIN
setp spindle_pid.FF0 [SPINDLE_9]FF0
# ---setup spindle control signals---
loadrt abs count=1
addf abs.0 servo-thread # analog output
net spindle-brake <= motion.spindle-brake
net spindle-at-speed => motion.spindle-at-speed
net spindle-vel-cmd-rps => motion.spindle-speed-out-rps => spindle_pid.command
net spindle-vel-fb-rps spindle_pid.feedback
net spindle-fwd abs.0.is-positive => hm2_5i20.0.gpio.046.out
net spindle-rev abs.0.is-negative => hm2_5i20.0.gpio.047.out
net spindle-on motion.spindle-on hm2_5i20.0.pwmgen.03.enable spindle_pid.enable
net pid-out spindle_pid.output => abs.0.in
net pid-abs abs.0.out => hm2_5i20.0.pwmgen.03.value
# ---Setup spindle at speed signals---
loadrt near
addf near.0 servo-thread
net spindle-vel-cmd-rps => near.0.in1 # commanded
net spindle-vel-fb => near.0.in2 # real
net spindle-at-speed motion.spindle-at-speed <= near.0.out
setp near.0.scale 1.2
Last edit: 27 Feb 2013 21:27 by andypugh.
The following user(s) said Thank You: emcPT
Please Log in or Create an account to join the conversation.
28 Feb 2013 10:31 #30668
by cmorley
Replied by cmorley on topic Current turning capabilities status
I think if you look carefully, PNCconf already loaded the PID component and called it spindle.
Look at the top of the main HAL file.
I think it load it but doesn't use it. PNCconf used to allow you to use PID for the spindle then I removed it.
I tell you this cause if you use Andy's code it will error when asked to load the PID because there is already one loaded.
Just a heads up.
Chris M
Look at the top of the main HAL file.
I think it load it but doesn't use it. PNCconf used to allow you to use PID for the spindle then I removed it.
I tell you this cause if you use Andy's code it will error when asked to load the PID because there is already one loaded.
Just a heads up.
Chris M
Please Log in or Create an account to join the conversation.
28 Feb 2013 17:59 #30670
by emcPT
Replied by emcPT on topic Current turning capabilities status
I managed to get a working configuration changing a bit of Andy code. Like cmorley said, there was already a pid.s, so I used that one to have a more equal syntax.
But there is something lacking. Unfortunately my knowledge is not enough.
It seams that the output is very low, as some scale was missing, it is similar to what I had (before trying the PID where I had to scale the output to 10V).
I post the current hal and ini files.
Once again thank you.
But there is something lacking. Unfortunately my knowledge is not enough.
It seams that the output is very low, as some scale was missing, it is similar to what I had (before trying the PID where I had to scale the output to 10V).
I post the current hal and ini files.
Once again thank you.
Please Log in or Create an account to join the conversation.
28 Feb 2013 18:14 #30671
by andypugh
Replied by andypugh on topic Current turning capabilities status
I think you need a positive FF0 and a negative encoder_scale.
That might also require you to switch FWD/REV pins.
The PID component isn't brilliant with negative coefficients.
Also, if FF0 is negative then a positive P-term will operate in the wrong direction..
That might also require you to switch FWD/REV pins.
The PID component isn't brilliant with negative coefficients.
Also, if FF0 is negative then a positive P-term will operate in the wrong direction..
Please Log in or Create an account to join the conversation.
Moderators: piasdom
Time to create page: 0.211 seconds