G96 CSS problem

More
26 Mar 2014 00:35 #45245 by jbunch
G96 CSS problem was created by jbunch
I am having a problem with G96 CSS.

With a start dia of 4.6 inches, D=1000 S=300 My spindle comes up to speed the joints move to start of cut but I do not get a spindle at speed and the joint sits.

It is the same for an X or a Z movement. My lathe is a backtool and this is done with the spindle in reverse or CCW. Testted with CW same thing.

As I raise the SFM higher and higher it will eventualy start to cut. But the speed is well above the 1000 rpm max and the system will take the spindle to absolute max 2500 rpm.

This started with the Gmoccapy GUI so I setup Touchy, I am also seeing the same behavior with Touchy. Also now seeing it with AXIS.

For now I have inserted G97 and it works at a fixed speed no CSS.
# ---Encoder feedback signals/setup---

setp hm2_5i20.0.encoder.02.counter-mode 0
setp hm2_5i20.0.encoder.02.filter 0
setp hm2_5i20.0.encoder.02.index-invert 0
setp hm2_5i20.0.encoder.02.index-mask 0
setp hm2_5i20.0.encoder.02.index-mask-invert 0
setp hm2_5i20.0.encoder.02.scale 2000

net spindle-index-enable motion.spindle-index-enable <=> hm2_5i20.0.encoder.02.index-enable
net spindle-revs motion.spindle-revs <=  hm2_5i20.0.encoder.02.position

# ---setup spindle control signals---

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-speed-out abs.2.in <=  motion.spindle-speed-out


# Change velocity to RPM

setp scale.1.gain 60

net spindle-velocity motion.spindle-speed-in near.0.in2 scale.1.in <= hm2_5i20.0.encoder.02.velocity

# End Velocity to RPM


# *** Spindle speed control
# PWM Generator signals/setup

setp hm2_5i20.0.pwmgen.02.output-type 1
setp hm2_5i20.0.pwmgen.02.scale  0.00094
net spindle-enable  hm2_5i20.0.pwmgen.02.enable <= pid.2.enable
net spindle-vel-cmd pid.2.command  <= abs.2.out
net spin-pid-out pid.2.output hm2_5i20.0.pwmgen.02.value

# *** End


# *** spindle at speed

setp near.0.scale 1.2
net spindle_speed_reqst_scaled  near.0.in1 <=  motion.spindle-speed-cmd-rps
#net spindle_ena_spindle_spd and2.12.in1 <= near.0.out
#net spindle_for_rev and2.12.in0 and2.3.in1 <= or2.5.out

#setp near.0.scale 1.2
#net spindle_speed_reqst_scaled  near.0.in1 <=  motion.spindle-speed-cmd-rps
#net spindle_ena_spindle_spd and2.12.in1 <= near.0.out
#net spindle_for_rev and2.12.in0 and2.3.in1 <= or2.5.out
# *** End Spindle at speed

Jim

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 02:44 #45253 by skunkworks
Replied by skunkworks on topic G96 CSS problem
a shot in the dark - but I think you want motion.spindle-speed-out (it is in rpm though) (or out-rps) I assume

net spindle_speed_reqst_scaled near.0.in1 <= motion.spindle-speed-cmd-rps

sam

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 02:57 #45255 by BigJohnT
Replied by BigJohnT on topic G96 CSS problem
Open Show Hal Configuration and put the near in's in a watch window and run your spindle.

JT

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 04:54 #45262 by newbynobi
Replied by newbynobi on topic G96 CSS problem
I do not see pid.2.feedback connection, how does the pid work?
Pwm scale shojld be max spindle rpm

I did mention a link in the gmoccapy thread, did you take a look at it?

I will post a working config, next time i am on my dev pc.

Norbert

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 06:32 - 26 Mar 2014 06:38 #45265 by jbunch
Replied by jbunch on topic G96 CSS problem
JT,

In midi mode all works well and I get spindle at speed. I only have a problem when using G96 CSS.
Synced spindle motion threading is OK also.

Jim

Norbert,

The pid does not realy use feedback it is scaled using setp hm2_5i20.0.pwmgen.02.scale 0.00094 and FF0

Jim
Last edit: 26 Mar 2014 06:38 by jbunch.

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 18:37 - 26 Mar 2014 18:41 #45275 by BigJohnT
Replied by BigJohnT on topic G96 CSS problem
What version of LinuxCNC are you using? I use CSS all the time on my CHNC with 2.5.3 and most of my ngcgui subroutines use G96.

JT
Last edit: 26 Mar 2014 18:41 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 18:57 #45276 by BigJohnT
Replied by BigJohnT on topic G96 CSS problem
Here is the spindle section of my CHNC.
#######
#Spindle uses encoder.02 and pwmgen.02
#######

#spindle scales
addf scale.0 servo-thread
addf scale.1 servo-thread

#10v/6000rpm=0.001667
setp scale.0.gain -0.0002
# offset for spindle
#setp scale.0.offset 0.0001loadrt pwmgen output_type=0 # This creates a 1Hz signal

setp scale.1.gain 60

#load abs comp make spindle RPM pos
loadrt abs count=3
addf abs.0 servo-thread
addf abs.1 servo-thread
addf abs.2 servo-thread

#spindle speed out limits
loadrt limit1 count=1
addf limit1.0 servo-thread
setp limit1.0.min -6000
setp limit1.0.max 6000

#set scale and pwm
setp hm2_5i20.0.encoder.02.scale -4096
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.02.output-type 1

net spindle-speed-limit motion.spindle-speed-out => limit1.0.in
net spindle-speed-limit-out limit1.0.out => scale.0.in
net spindle-speed-DAC scale.0.out => hm2_5i20.0.pwmgen.02.value
net spindle-rpm => abs.1.in
net spindle-speed-abs <= abs.1.out

#spindle enable
net spindle-enable-req motion.spindle-on => and2.1.in0
net spindle-brake-sensor hm2_5i20.0.gpio.051.in_not => and2.1.in1
net spindle-enable and2.1.out => hm2_5i20.0.pwmgen.02.enable

# enable spindle drive
net spindle-enable => hm2_5i20.0.gpio.065.out
# force spindle lock pin out
net spindle-enable => hm2_5i20.0.gpio.042.out

# release spindle brake
net spindle-brake-prg not.0.out => or2.2.in0
net spindle-brake-logic motion.spindle-brake => not.0.in
net spindle-brake hm2_5i20.0.gpio.040.out <= or2.2.out

#spindle sync
net spindle-index motion.spindle-index-enable <= hm2_5i20.0.encoder.02.index-enable
net spindle-velocity motion.spindle-speed-in <= hm2_5i20.0.encoder.02.velocity
net spindle-revs motion.spindle-revs <= hm2_5i20.0.encoder.02.position

net spindle-velocity => abs.0.in
net spindle-v-abs abs.0.out => scale.1.in
net spindle-v-abs-out <= scale.1.out

# spindle speed
net spindle-velocity mult2.0.in0
setp mult2.0.in1 60
net spindle-abs abs.2.in mult2.0.out
net spindle-rpm  abs.2.out

# spindle at speed
setp near.0.difference 0.1
net spindle-velocity near.0.in1 
net com-spindle-vel near.0.in2 <= motion.spindle-speed-out-rps
net spindle-at-speed near.0.out <= motion.spindle-at-speed

# trick Axis
net trick-axis motion.spindle-reverse

#######
#end of spindle
######

JT

Please Log in or Create an account to join the conversation.

More
26 Mar 2014 21:53 #45281 by newbynobi
Replied by newbynobi on topic G96 CSS problem
Helo Jim,

if you do not use feedback, why do you use a PID? It is not necessary then.

This is a spindle.hal that works with PID and in both directions. (7i43 and 7i40 with DC motor and self made encoder)
wotks within 3 % accuracy! Encoder with 1000 ppr and max spindle speed 3500 rpm
#*******************
#  SPINDLE S
#*******************

# as I do use a 7i43 we will have to load the stuff for that
# you may need to add this to your needs
loadrt hostmot2
loadrt hm2_7i43 ioaddr=0xcc00 epp_wide=0 config="firmware=hm2/7i43/SVST4_4S.BIT num_encoders=2 num_pwmgens=2 num_stepgens=0" 
setp     hm2_7i43.0.pwmgen.pwm_frequency 100000
setp     hm2_7i43.0.pwmgen.pdm_frequency 100000
setp     hm2_7i43.0.watchdog.timeout_ns 10000000
addf     hm2_7i43.0.read servo-thread
addf     hm2_7i43.0.write         servo-thread
addf     hm2_7i43.0.pet_watchdog  servo-thread

# for closed loop we ned a PID control, so lets load it
loadrt pid num_chan=1
addf pid.0.do-pid-calcs servo-thread
setp   pid.0.Pgain     [SPINDLE_9]P
setp   pid.0.Igain     [SPINDLE_9]I
setp   pid.0.Dgain     [SPINDLE_9]D
setp   pid.0.bias      [SPINDLE_9]BIAS
setp   pid.0.FF0       [SPINDLE_9]FF0
setp   pid.0.FF1       [SPINDLE_9]FF1
setp   pid.0.FF2       [SPINDLE_9]FF2
setp   pid.0.deadband  [SPINDLE_9]DEADBAND
setp   pid.0.maxoutput [SPINDLE_9]MAX_OUTPUT

# ---PWM Generator signals/setup---
# no quadratur counting = 1 else 0
setp   hm2_7i43.0.pwmgen.01.output-type 1
# Set the spindle's top speed in RPM
setp   hm2_7i43.0.pwmgen.01.scale  3500

# ---Encoder feedback signals/setup---
setp    hm2_7i43.0.encoder.01.counter-mode 1
setp    hm2_7i43.0.encoder.01.filter 1
setp    hm2_7i43.0.encoder.01.index-invert 0
setp    hm2_7i43.0.encoder.01.index-mask 0
setp    hm2_7i43.0.encoder.01.index-mask-invert 0
setp    hm2_7i43.0.encoder.01.scale  [SPINDLE_9]INPUT_SCALE

# we need a scale for feedback to the pid
loadrt scale names=scale_rps_to_rpm
addf scale_rps_to_rpm servo-thread
setp scale_rps_to_rpm.gain 60

# ---setup spindle control signals---
net spindle-on           hm2_7i43.0.pwmgen.01.enable  <=  pid.0.enable  <=  motion.spindle-on
net spindle-vel-cmd      pid.0.command  <=  motion.spindle-speed-out
net spindle-output       pid.0.output  =>  hm2_7i43.0.pwmgen.01.value
net spindle-vel-fb-rps   hm2_7i43.0.encoder.01.velocity  =>  scale_rps_to_rpm.in
net spindle-vel-fb-rpm   scale_rps_to_rpm.out  =>  pid.0.feedback  
net spindle-vel-fb-rpm   motion.spindle-speed-in
net spindle-index-enable motion.spindle-index-enable  <=  hm2_7i43.0.encoder.01.index-enable

##############################
# spindle at speed detection #
##############################
loadrt near names=near_spindle_speed
addf near_spindle_speed servo-thread
# set the spindle speed inputs to agree if within 3%
setp near_spindle_speed.scale 1.03

# connect one input to the commanded spindle speed
# we declared above already 
# net spindle-vel-cmd      pid.0.command  <=  motion.spindle-speed-out
net spindle-vel-cmd     near_spindle_speed.in1

# and the other input to the encoder-measured spindle speed
# we declared above already 
# net spindle-vel-fb-rpm   scale_rps_to_rpm.out =>  pid.0.feedback  
net spindle-vel-fb-rpm  near_spindle_speed.in2

# connect the output to the spindle-at-speed input
net spindle-at-speed    motion.spindle-at-speed  <=  near_spindle_speed.out
you will need to adapt the PID values to your hardware

My INI has the following values:
#********************
# Spindle
#********************
[SPINDLE_9]
P = 4.0
I = 10.0
D = 0.0
FF0 = 1.0
FF1 = 0.8
FF2 = 0.0
BIAS = 0.0
DEADBAND = 5
OUTPUT_SCALE = 1.0
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 0.0
INPUT_SCALE = 1000.0

and for gmoccapy you need to connect than:
loadrt abs names=abs_spindle_feedback
addf abs_spindle_feedback servo-thread

net spindle-vel-fb-rpm   abs_spindle_feedback.in
net spindle-speed-rpm    abs_spindle_feedback.out  =>  gmoccapy.spindle_feedback_bar

net spindle-at-speed      gmoccapy.spindle_at_speed_led

hope that helps.

Norbert
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Mar 2014 00:00 #45286 by jbunch
Replied by jbunch on topic G96 CSS problem
JT,

I am using master. 2.6.0. It used to work with AXIS and 2.5.3 and it used to work with master. It now seems to have problems.

Jim

Please Log in or Create an account to join the conversation.

More
27 Mar 2014 06:16 - 27 Mar 2014 06:27 #45292 by BigJohnT
Replied by BigJohnT on topic G96 CSS problem
Did you change "anything" between 2.5.3 and master?

The basic G96 test in sim/lathe works fine.

JT
Last edit: 27 Mar 2014 06:27 by BigJohnT.

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum