configuring gearchange
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?
Please Log in or Create an account to join the conversation.
Couple of things that leap out:-
Should be gearchange.0#addf gearchange servo-thread (barfs on this)
You are attaching a RPS figure to a component you have set up to work in RPMnet spindle-velocity => gearchange.0.speed-in
Probably just because not loaded (and there is no signal here, just 2 pins)net gearchange.0.speed-out => lowpass.0.in (error on this)
regards
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
# 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
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
I hope I am not repeating anyone elses questions, I am just extremely green when it comes to this software, but am picking it up quickly as I go along.
Thanks
Rick
Please Log in or Create an account to join the conversation.
After following the posts about the gearchange option, I am not sure where I connect my gear input to let the gearchange function work, I have set up an M141/M142 command to shift the transmission and have a pressure switch on both speeds to let me know it is in its respective gear, and I think i need to connect to the gearchange.0.sel input but am not sure how, I assume it is a net command of some sort.
I think gearchange only pays any attention to one switch (probably on the high gear) so it would be:
net high-gear-selected parport.0.pin-NN-in => gearchange.0.sel
Assuming you are using a parport, and of course the NN needs to be an actual number.
Please Log in or Create an account to join the conversation.
Thanks
Rick
Please Log in or Create an account to join the conversation.
I have two speed and electronic coupling gear change and i would like to do it automaticaly when in constant surface speed .
High gear 1:1 = 1000 rpm, lower gear 1:5 = 200 rpm
How to automaticaly change scale from 200 to 1000 ?
Regards
Please Log in or Create an account to join the conversation.