Hi all

Unfortunatly i have another question related to spindle :

The linked DAC seems to work correctly with my PWM output, but need to 
tweak pwm for output something like :

0% PWM = -3300rpm
50% PWM = 0rpm
100% PWM = 3300rpm
(i think i have understand that is better to not use 0% to 100% but 
something like 5% to 95%)

I have try to play with BIAS = 50 with this settings but seems to not work 
fine for reversing direction.
Also try to change output_scale = 120

hal:


#####################################################################
# Spindel VFD closed loop with PID LOWPASS NEAR SCALE
#####################################################################


newinst pid pid-s                   # used for closed loop spindle
newinst lowpass lp-s-fb
newinst near near-s-fb              # used for spindle at speed
newinst scale scale-spindle-rpm     # used for display RPM to user


# maxerror is related to the Igain (max value possible to add by pid = 
Igain x maxerrorI)
setp pid-s.maxerrorI 0
setp pid-s.Pgain 0
setp pid-s.Igain 1
setp pid-s.Dgain 0
setp pid-s.bias 50
setp pid-s.FF0 1
setp pid-s.FF1 0
setp pid-s.FF2 0
setp pid-s.deadband .05
setp pid-s.maxoutput [SPINDLE]OUTPUT_SCALE


setp near-s-fb.scale 1.01        # 1.01 Allow 1% / 1.1 Allow 10% for speed 
cmd vs real
setp lp-s-fb.gain 0.005




# --- Spindle encoder
setp hpg.encoder.00.chan.00.scale [SPINDLE]ENCODER_SCALE  # counts per 
revolution
setp hpg.encoder.00.chan.00.filter 1                      # Currently 
unsupported, included for compatability with hm2. ????  
setp hpg.encoder.00.chan.00.index-mask 1                  # Currently 
unsupported, included for compatability with hm2. ????  
                                                          # disable encoder 
index as it is not working in pru encoder (finally seems to be ok)
#setp hpg.encoder.00.chan.00.counter-mode 0               # Quadrature mode 
AB default


net spindle-index-enable motion.spindle-index-enable <=> hpg.encoder.00.chan
.00.index-enable pid-s.index-enable # need testing


# ---Spindle VFD closed loop with PID and compensation
net spindle-pos hpg.encoder.00.chan.00.position => motion.spindle-revs     
                      # report our revolution count to the motion controller
net spindle-vel-fb hpg.encoder.00.chan.00.velocity => lp-s-fb.in 
#pid-s.feedback 
                # report encoder speed to pid and speed filter input

net spindle-vel-fb-lp lp-s-fb.out => near-s-fb.in2 motion.spindle-speed-in 
scale-spindle-rpm.in pid-s.feedback # report speed filtered to motion 
controller + scale input
                                                                            
                     # +report speed filtered to near component  = Yes/No 
allowed with 1% difference


net spindle-at-speed near-s-fb.out => motion.spindle-at-speed               
                     # connect the near output to motion spindle-at-speed = 
Yes/No
setp scale-spindle-rpm.gain 60                                             
                      # scale filtered speed RPSx60 = asked RPM 
net spindle-vel-rpm scale-spindle-rpm.out                                   
                     # create hal for user display asked RPM connected with 
scale
# ---setup spindle control signals and soft start---
newinst limit2 lim-s-speed

setp lim-s-speed.min -[SPINDLE]OUTPUT_MAX_LIMIT
setp lim-s-speed.max [SPINDLE]OUTPUT_MAX_LIMIT
setp lim-s-speed.maxv [SPINDLE]MAX_ACC
setp hpg.pwmgen.00.out.00.scale [SPINDLE]OUTPUT_SCALE
setp hpg.pwmgen.00.pwm_period [SPINDLE]OUTPUT_PERIOD         # spec du 
controler ACRF16

net spindle.is-on motion.spindle-on hpg.pwmgen.00.out.00.enable             
              # active pwmgen only when spindle is on from motion 

net spindle-vel-cmd-rps motion.spindle-speed-out-rps lim-s-speed.in near-s-
fb.in1
net spindle-vel-cmd-rps-lim lim-s-speed.out => pid-s.command               
         # WITH PID FOR WORKING
#net spindle-vel-cmd-rps-lim lim-s-speed.out => hpg.pwmgen.00.out.00.value 
           # WITOUT PID FOR TEST
net spindle-output pid-s.output => hpg.pwmgen.00.out.00.value               
      

net spindle-vel-cmd <= motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs

net spindle.is-on => pid-s.enable fur.do-6                     # output pin



Ini :
# Spindle
[SPINDLE]
ENCODER_SCALE = 400
# Settings below are in Hz
OUTPUT_PERIOD =  10000000
# Settings below are in unit/second
OUTPUT_SCALE = 60
OUTPUT_MAX_LIMIT = 55
#             #55*60seconde = 3300rpm
MAX_ACC = 17


I'm really lost with these spindle settings from long time, any help are 
really welcome.


Ps : i hope a very good end of the years at all !

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/machinekit/304b7ddf-e388-427c-a662-350eddf275fa%40googlegroups.com.

Reply via email to