hy_vfd spindle-at-speed true for > 0, false for 0 (M5..)

More
14 Mar 2022 03:12 #237182 by realizer
Hi,

I'm debugging for 2 days now and got no idea whats wrong.
I've got a rattm 3kw atc spindle, a hy vfd connected via rs485 to my mesa 7i76 linuxcnc.
If I try to control the spindle speed it spins at desired speed and vfd.spindle-at-speed is 1 if speed is set to anything > 0.
juhuu
But if I stop the spindle spindle-at-speed stays 0, which was quite unpleasant when the Z(c) axis went on moving after a timeout (?) and "kissed" the wise :( Learned: G1 & friends are waiting for spidle, (DEBUG, blah) not :)
I downloaded the source of hy_vfd and tried to recalculate what its doing.
Mainly
....
*haldata->spindle_speed_fb = (*haldata->Out_F / *haldata->max_freq) * *haldata->rated_motor_rev;
if (fabs(1 - (*haldata->spindle_speed_fb / fabs(*haldata->speed_command))) < *haldata->spindle_at_speed_tolerance) {
  *haldata->spindle_at_speed = 1;
} else {
  *haldata->spindle_at_speed = 0;
}
....
While debugging with -g -y I got 170 for out_f, 40000 for max_freq, 3000 for rated_motor_rev

When i calulate 170 (out_f) * (24000(max rpm)/40000) I get 102 which was the rpm while testing.

hy_vfd does
  haldata->spindle_speed_fb = haldata->Out_F(=0xaa 170) / *haldata->max_freq (=40000)) * *haldata->rated_motor_rev (=3000);
  -> haldata->spindle_speed_fb = 12.75 rpm
which then gets compared to speed_command which is 101 (~102) and even with tolerance should not match (but does spindle-at-speed is 1)
0rmp should lead to (0x00 = 0 -> read from "-g") / max_freq(40000) * rated_motor_rev(3000) = 0
compared to 0 is 1 (matches)

I'm confused.. Does anyone know where's my mistake?

Jochen


My VFD config:
PD001 = 2
PD002 = 2
PD003 = 40000
PD004 = 40000
PD005 = 40000
PD006 = 250
PD007 = 50
PD008 = 2200
PD009 = 150
PD010 = 80
PD011 = 0
PD144 = 3000

VFD reporting
Out_F @ 0 RMP = 0x00
Out_F @ 101 RMP = 0xAA
to linuxcnc


my extra spindle.hal (added -S -F -f but no difference):

loadusr -Wn vfd hy_vfd -g --regdump -n vfd -S 24000 -F 400 -f 0 -d /dev/ttyUSB0 -p none -r 9600

net spindle-cmd-rpm-abs            => vfd.speed-command
net spindle-cw spindle.0.forward   => vfd.spindle-forward
net spindle-ccw spindle.0.reverse  => vfd.spindle-reverse
net spindle-on spindle.0.on                => vfd.spindle-on

net vfd-spindle-speed-fb <= vfd.spindle-speed-fb

net spindle-at-speed spindle.0.at-speed => vfd.spindle-at-speed

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

More
14 Mar 2022 03:14 #237183 by realizer
Sorry,
PD003 = 40000
PD004 = 40000
PD005 = 40000
where taken from debug output. At the display of the vfd they are 400.00

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

More
14 Mar 2022 05:07 #237188 by cmorley
What were you expecting that did not happen?
You want the spindle at speed to be true at 0 RPM?
The following user(s) said Thank You: tommylight

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

More
14 Mar 2022 11:01 #237202 by realizer
after an "M5" or an "M3 S0" .. and after the spindle stands still, yes

It works while spinning up (eg. M3 1000) but my M6 T0 script also needs to wait not to put a spinning tool back to its place..

I must have made a little stupid configuration error which I can't find. Does PD144 have to be 3000 for a 24k spindle@400Hz?

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

More
21 Mar 2022 01:18 #237866 by realizer
Am I totally wrong? Plz help :)

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

More
21 Mar 2022 03:23 #237871 by cmorley
I can't really figure out what the problem is from your description.
I don't understand how having spindle at speed set to 1 when the spindle is stopped would help your described crash.

One thing to note is that spindle at speed only restricts movement in specific situations.
It was actually designed for lathe work.

You are free to synthesize spindle at speed from any input - you don't need to use hy_vfd's component's pin.

It may be better for you to use the motion inhibit pin.

Chris

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

More
23 Mar 2022 22:04 #238149 by andypugh

You are free to synthesize spindle at speed from any input - you don't need to use hy_vfd's component's pin.

I would suggest using an and2 block using hy_vfd.spindle-at-speed and hy_vfd.spindle-speed (?) > 5000 (or half the minimum spindle speed) 

Though this will block all G1 moves with the spindle not turning. (which sounds like what you want, but not what everyone wants) 


 

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

More
30 Mar 2022 14:47 #238738 by realizer
@cmorley If the spindle would be @ 0 RPM while putting the tool to the toolholder (magazine..), this would keep the toolholder in the tool magazine where it rests in shape :) Spinning up to the RPM a tool should mill/cut with is working fine. I can't just get a valid value (1) after an M5 (and when it is really 0 RPM).
My workaround for now is to wait 10 seconds after m5 and hope that this is the case.. (and set spindle_at_speed always to 1)

@andypugh This sounds like a solution. Thanks a lot. I' ll try it out. Do you know if this is a bug in the hy_vfd or in my expectations when spindle_at_speed should be 1?

Very kind regards and sorry for my bad english

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

More
30 Mar 2022 19:09 #238797 by andypugh

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

Time to create page: 0.552 seconds
Powered by Kunena Forum