NEWS
LinuxCNC 2.5.2 Release
LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 

Welcome, Guest
Username: Password: Remember me

TOPIC: configuring gearchange

configuring gearchange 22 Feb 2012 20:25 #17957

  • chuck1024
  • chuck1024's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Karma: 2
I am trying to use gearchange to select a belt speed on my Emco lathe and I am not making much progress. I really need an example but cannot find one. Also it is not clear to me what units gear change expected for input and output (RPS or RPM)

I have a spindle speed panel from stepconf. The code looks like this which has been commented out for now

#setp scale.0.gain 60
#setp lowpass.0.gain 0.01
#net spindle-velocity => lowpass.0.in
#net spindle-rps-filtered <= lowpass.0.out
#net spindle-rps-filtered => abs.0.in
#net absolute-spindle-vel <= abs.0.out => scale.0.in
#net scaled-spindle-vel <= scale.0.out => pyvcp.spindle-speed

I have tried various things resembling this:
loadrt gearchange
#addf gearchange servo-thread (barfs on this)
setp gearchange.0.min1 50
setp gearchange.0.max1 1200
setp gearchange.0.min2 100
setp gearchange.0.max2 2000
setp gearchange.0.scale2 1.66
setp gearchange.0.sel 1

net spindle-velocity => gearchange.0.speed-in

setp scale.0.gain 60
setp lowpass.0.gain 0.01

net gearchange.0.speed-out => lowpass.0.in (error on this)

net spindle-rps-filtered <= lowpass.0.out
net spindle-rps-filtered => abs.0.in
net absolute-spindle-vel <= abs.0.out => scale.0.in
net scaled-spindle-vel <= scale.0.out => pyvcp.spindle-speed

SO.
1) does it need filtering?
2)does it need scaling?
3)how do I connect it to existing signals?
The administrator has disabled public write access.

Re:configuring gearchange 23 Feb 2012 02:44 #17959

  • ArcEye
  • ArcEye's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1418
  • Thank you received: 114
  • Karma: 130
Hi

Couple of things that leap out:-
#addf gearchange servo-thread (barfs on this)
Should be gearchange.0
net spindle-velocity => gearchange.0.speed-in
You are attaching a RPS figure to a component you have set up to work in RPM
net gearchange.0.speed-out => lowpass.0.in (error on this)
Probably just because not loaded (and there is no signal here, just 2 pins)


regards
Last Edit: 25 Feb 2012 06:40 by ArcEye.
The administrator has disabled public write access.

Re:configuring gearchange 24 Feb 2012 18:39 #18061

  • chuck1024
  • chuck1024's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Karma: 2
I did this which now displays the speed on the panel.
but nothing changes when I change gearchange.0.sel from 0 to 1

For instance, I do M3 S500 and the spindle RPM is about 300 with the belt on low. So I conclude the PWM gen is still following the command setp pwmgen.0.scale 2000.0 It is setting the motor speed as if 2000 was top speed but in gear 0, 1200 is top speed.

I think all I really need to do to make the spindle RPM match the S word is change the pwmgen scale for each belt. How can I do that? I tried creating M codes M100-102 with a setp pwmgen.0.scale in each file but it did not seem to take affect.

I really need 3 speeds anyway. Should I scrap this and move on to a 3 speed spindle?
chuck

#setp scale.0.gain 60
#setp lowpass.0.gain 0.01
#net spindle-velocity => lowpass.0.in
#net spindle-rps-filtered <= lowpass.0.out
#net spindle-rps-filtered => abs.0.in
#net absolute-spindle-vel <= abs.0.out => scale.0.in
#net scaled-spindle-vel <= scale.0.out => pyvcp.spindle-speed

loadrt gearchange
addf gearchange.0 servo-thread

setp gearchange.0.min1 0
setp gearchange.0.max1 1200
setp gearchange.0.min2 0
setp gearchange.0.max2 2000
setp gearchange.0.scale2 1.66
setp gearchange.0.sel 0

setp scale.0.gain 60
setp lowpass.0.gain 0.01
net spindle-velocity => lowpass.0.in
net spindle-rps-filtered <= lowpass.0.out
net spindle-rps-filtered => abs.0.in

net absolute-spindle-vel <= abs.0.out => scale.0.in
net spindle-junk <= scale.0.out => gearchange.0.speed-in
net scaled-spindle-vel <= gearchange.0.speed-out => pyvcp.spindle-speed
The administrator has disabled public write access.

Re:configuring gearchange 25 Feb 2012 05:30 #18076

  • ArcEye
  • ArcEye's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1418
  • Thank you received: 114
  • Karma: 130
Apologies,

Think I had my head on backwards yesterday, I just followed your use of components regards displayed speed without actually looking at whether they were doing what you wanted.

If you have a spindle encoder index pulse of some sort, the RPS will always be correct, so you need to scale it to get RPM, remove the sign and put though a lowpass filter to stabilise it, then use it in your pyvcp speed display.
What is displayed will be the actual RPM, irrespective of what gear you are in.

When you use gearing, the speed figure to the motor needs scaling to reflect the effect of gearing upon the output spindle speed.
A commanded speed of S600 gives 600 RPM on a 1:1 drive but only 300 on a 1:2 drive

This link shows my solution to spindle gearing.

I have a user M code routine which changes the scale for each pulley position.
This is a second scale component, is linked to the stepgen which controls the spindle velocity.

www.linuxcnc.org/index.php/english/compo...id=10&id=15717#15762

The exact scale was determined by using a optical tachometer and incrementing the scale value,
to get the exact rpm required for the most commonly used speed in each pulley range

regards
The administrator has disabled public write access.

Re:configuring gearchange 25 Feb 2012 08:48 #18085

  • chuck1024
  • chuck1024's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Karma: 2
Thanks. I added a scale to my pwmgen

# add scale for gear changes
# pwm configured for middle belt 0-2000
setp scale.1.in 0
setp scale.1.gain 1
setp scale.1.offset 0
addf scale.1 servo-thread

net spindle-cmd <= motion.spindle-speed-out => scale.1.in
net spindle-value <= scale.1.out => pwmgen.0.value
net spindle-enable <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm

setp pwmgen.0.pwm-freq 50.0
setp pwmgen.0.scale 2000.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net spindle-cw <= motion.spindle-forward

I was kind of lazy and use 3 M codes structured like this in files M100 to M102
!/bin/bash
# file to set gear 1 0-1200RPM
halcmd setp scale.1.gain 1.55;
exit 0

I created some soft buttons on the screen modeled over big Johns toolchange buttons
<labelframe text="Gear Change">
<font>("Helvetica",16)</font>
<hbox>
<button>
<halpin>"gear-1"</halpin>
<text>"G1"</text>
<bd>3</bd>
</button>
<button>
<halpin>"gear-2"</halpin>
<text>"G2"</text>
<bd>3</bd>
</button>
<button>
<halpin>"gear-3"</halpin>
<text>"G3"</text>
<bd>3</bd>
</button>
</hbox>

</labelframe>

and added the gear change command to the machine.ini
[HALUI]
# add halui MDI commands here (max 64)
MDI_COMMAND = T1 M6 G43
MDI_COMMAND = T2 M6 G43
MDI_COMMAND = T3 M6 G43
MDI_COMMAND = T4 M6 G43
MDI_COMMAND = T5 M6 G43
MDI_COMMAND = T6 M6 G43
MDI_COMMAND = M100
MDI_COMMAND = M101
MDI_COMMAND = M102

IT WORKS!
thanks
The administrator has disabled public write access.

Re:configuring gearchange 26 Feb 2012 10:54 #18104

  • chuck1024
  • chuck1024's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 55
  • Karma: 2
I found a simpler solution.

I removed the scale element show in the previous post and put

halcmd setp pwmgen.scale1200 in M100 file
halcmd setp pwmgen.scale 2000 in M101 file
halcmd setp pwmgen.scale 3000 in M102 file

Now when I change belt positions, I just click on the right gear button and the pwmgen scale
is changed so that S word generate the correct speed.

All three M commands could be combined in one file as shown by the link, but I like to start simple.

Life is good. Smile!
chuck
The administrator has disabled public write access.
Time to create page: 1.013 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.