Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TTalma on April 09, 2018, 06:44:13 PM

Title: My File is running real slow
Post by: TTalma on April 09, 2018, 06:44:13 PM
I am running the file below:

This is a new machine, and this is the first file I am attempting to run.

When it runs the machine moves real slow. But shouldn't it be running at the machines maximum feedrate? (I am air cutting to test it out). Currently as it is running it would take about 20 min for A to turn 360 degrees.

The only thing I can think of is that it's the settings for the motors. When I add A to the motion is when it slows way down. X, Y, Z resolution is .005". My goal for the A axis is to have the same resolution at a 4" circumference.

What do i need to do to get my code running at a decent speed?

X: 2000 steps/inch, Velocity 350 Inches/min, Accel 50
Y: 2000 steps/inch, Velocity 350 Inches/min, Accel 50
Z: 8000 steps/inch, Velocity 50 Inches/min, Accel 12.5
A 81.2698 steps/inch, Velocity 10800 Inches/min, Accel 2700



O0001
G90
G00 X0 Y18.5
G00 Z-1
G91
M98 P2 L36 (call function, Function 0002, do it 34 times ->18 inches)
G01 Y-.25 A180
G01 Y-.125 A90 Z.29
G00 Z0
G00 Y0 A0
M30
(Thread cutting loop)
O0002
G01 Y-.5 A360
M99
%
Title: Re: My File is running real slow
Post by: joeaverage on April 09, 2018, 06:56:28 PM
Hi,
G00 is a move at rapid traverse rate, ie the maximum the motors can run according to your tuning.

G01 is a move at the prevailing feed rate. You haven't specified a feed rate. Try putting a line F100 near the top
of the file and try again.

Next thing to do is seperate the A axis moves from the linear moves and specify a suitable feed rate on the A axis move line.

You might consider a basic text about Gcode.

Craig
Title: Re: My File is running real slow
Post by: RICH on April 09, 2018, 07:13:41 PM
The A axis is a rotary and it should be configured as such thus steps per degree not steps per inch.
Think you are getting confused about  the linear and rotary selection boxes in general configuration.


OOPs  :D Just noticed this is a Mach4 discussion .............  BYE ;D

RICH
Title: Re: My File is running real slow
Post by: TTalma on April 10, 2018, 05:04:29 PM
Thanks for pointing that out. I played with the feedrate and had to up it to 2000 to get a decent speed. The cycle takes about 7:00 min to run.

Does this seem normal that I would have to set the feedrate so high?

Also when it finishes the line: G01 Y-.5 A360
it goes to the last line: M99

But it pauses for about a half second. Is there a way to eliminate the pause?
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 05:12:47 PM
Hi,
no, that would suggest a feed rate of 2000 inches/minute. Are you sure that you Gcode is in inches?
Sounds more like 2000 mm/minute. Try putting a G20 at the top of the file.

Craig
Title: Re: My File is running real slow
Post by: TTalma on April 10, 2018, 05:56:30 PM
Added a G20 No difference.

I also verified that I am in inchs
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 06:07:01 PM
Hi,
yes your native units are in inches but your Gcode can still be in mm, its determined by G20/G21.

If you are of the opinion that both your native units are inches AND your machine is interpreting the current Gcode
in inches then your motor tuning is way out.

Craig
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 06:08:36 PM
Hi,
may I suggest making and running a simple file without A axis movements. Once your happy about how the linear axes work
then add a rotary axis.

Craig
Title: Re: My File is running real slow
Post by: TTalma on April 10, 2018, 06:35:59 PM
I just ran a simple program and nice and fast like I would expect (below)

I do think it's the tunning because A is way out from the others.

I attached my motor tuning pictures. I am running the A axis from a stepper. The stepper has a 14 tooth pulley, and A axis has a 32 tooth pulley. I'm looking to get .005" resolution on a cylinder with a 4" diameter.

G20
O0001
G90
G00 Z0
G00 X0 Y0
G00 Z-1
G00 X5
G00 Y5
F100
G01 Z0
G01 X0 Y0
G01 Z-1
G01 X5
G01 Y5
G00 Z0
G00 X0 Y0
M30
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 07:12:21 PM
Hi,
try an even simpler program, just one axis at a time.

Say:
g0 x0
x10
x0
x10
x0

should cause x to go back and forth at the max rate ie 350 in/min

Do the same with y and z axes.
Now try:
g1 x0 f100
x10
x0
x10
x0
should cause x to go back and forth at 100 inch/min.
Repeat the same test with y and z axes.

Once you've got those sorted then start with the a axis.

Craig
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 07:13:03 PM
Hi,
note that the a axis units are degrees....

Craig
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 07:39:41 PM
Hi,
if you want .005 resolution on a 4 inch diameter:

.005/ 2(radius) =0.0025 radian=0.18 degree.

Your stepper (at full step) with the belt reduction is 1.8/ (32/14)=0.787 degree per full step.
You will need a microstep setting of at least 8 (1600 steps per revolution) to achieve your resolution.

If you set your driver at 8 microsteps your 'step per unit' in the motor tuning page should be:
(1600 x32/14)/360= 10.16 steps per degree.

A suitable speed might be one rev per second or 360 degrees per second or 21600 degrees per minute.
Suggest an acceleration of 300.

Try it and see.

Craig
Title: Re: My File is running real slow
Post by: TTalma on April 10, 2018, 07:55:03 PM
Thanks I gave those 2 files a test and it moved as expected.

I set the driver and the motor setting to the values you suggested. I worked correctly. It took 1:12 to rotate which works out to 300 degrees per minute.

I'd like to get higher speeds than that though.
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 08:41:09 PM
Hi,
fine, then up the velocity, 21600 degrees per min is one rev per second, double it and see what happens.

When you have a rotary axis which has such wildly different numbers as these you can get into diffuculty.
If for instance you specify F=200 expecting the linear axes to travel at 200 inch/min then you'll be dissapointed,
the rotary axis will rotate at 200 degrees/min, less that one turn per min, and the linear axes will move glacially
slowly to stay synchronised.

In this circumstance the slowest axis determines the speed of all the rest.

Now imagine you you set F=20000 that would allow the rotary axis will go about 1 rev per second but the linear axes can
only go 350 inch/min and will that will limit the speed of the rotary axis to stay synchronised. Again its the slowest axis
that sets the pace.

Craig
Title: Re: My File is running real slow
Post by: joeaverage on April 10, 2018, 09:06:00 PM
Hi,
try a file with just rotary moves:

g0 a0
a270
a0
a270
a0
should move the a axis back and forth 3/4 turn at the max rate, about 360 degrees per second.

Now
g1 a0 f5000
a270
a0
a270
a0
What happens?

Craig
Title: Re: My File is running real slow
Post by: TTalma on April 11, 2018, 08:16:50 AM
Thank I'll try just the A tonight.

What you are saying about the slowest axis makes sense. I'm not sure how to get around the huge difference in feedrates.

I watched some videos of commercial A axis and found a some sample code for setting them up. The feedrates were more in line with what I expected (they used 50, 100 and 200) in the videos, with good movement and rotation speeds.

I am curious how there mechanics work. I made mine from stuff I had lying around, so I understand I'm not going to get the same performance as a $4k+ professional tool. But they are still being accurate as they rotate. Is it all software?
Title: Re: My File is running real slow
Post by: RICH on April 11, 2018, 08:21:05 AM
To supplement Gaig's replies, the following should be of value.

Quote
What do i need to do to get my code running at a decent speed?

You will need to know what is the max velocity is for each of the axis.
 In a synchronised move the slowest axis determines the speed of all the rest.
So you are limited by the slowest max velocity.

One can use a  Stepper Caculator located in Members Doc's to find steps per unit and it
also gives additional info.

http://www.machsupport.com/forum/index.php/topic,16315.0.html

Assuming that the XYZ are tuned and represent reliable operation then you have the max
velocity in units per min. Now you need to know the same for an A axis ( rotary )
and it's nice be able to relate the deg/min (max feedrate) to the linear axes feedrate.

You tune a rotary similar to a linear axis as follows:
- Steps per degree is calculated.
- use a velocity ( deg per min) of 360 and accel of say 10
- double the velocity until the rotary skips, and reduce velocity by say 10%.
- now increase the accel, say 10, 400, 1600, 3200, etc and find where it skips
  for the max velocity found.
You have now know where the A axis skips for a your velocity and acceleration settings.

To relate the rotary to rpm just  manualy time ( or  measure rpm ) how long  it takes to make
 1 revolution, say over 4 revolutions. Do that for a few lower / different velocity settings below
the max velocity found.

The attached shows results of the above in a spread sheet.
Angular Motor Tuning shows an rpm value for the rotary.
Linear unit per Min at table RPM - Since the slowest axis will govern the max velocity that
can be used in a sychronized move this relates the linear axis to roatry axis velocities.
Say the max linear axes velocity is set at 60 inches per min and is represented by the yellow,
then max angular velocity for a  coded sychronized move should be restricted such that it doesn't
exceed the rotary table rpm.

You have what you have and if  not satisfactory then change the mechanics of the system.

RICH
Title: Re: My File is running real slow
Post by: TTalma on April 11, 2018, 05:22:55 PM
I tried the just A code as recommended and it run nice and fast, the second file slowed it down to about 1/4 the speed.

I was thinking about this today. And I think what I want is my Feedrate for the A axis in revolutions per min. I am have a hard time switching my brain to degrees per minute.

At 21600 dpm, this is a feedrate of 60 rpm. And When i look at it that way it makes sense to me.

Is there a way to make mach go in rpm?
Title: Re: My File is running real slow
Post by: joeaverage on April 11, 2018, 06:26:29 PM
Hi,
what you are talking about is changing Machs Gcode interpreter which I don't think is possible, certainly
without major support/cooperation from NFS.

Even if you changed the DROs so it appeared that rotational axes appeared in units of per revolution,
all CAM programs still generate rotational axes in degrees.

Quote
I am have a hard time switching my brain to degrees per minute.
The short answer is reprogram your head!

Craig
Title: Re: My File is running real slow
Post by: Chaoticone on April 11, 2018, 07:51:41 PM
The proper solution is to use G93 – Inverse Time Feed. Study up on it. You can find information about it in the Mill Gcode programming.pdf file in your Mach4/Docs folder.
Title: Re: My File is running real slow
Post by: Cbyrdtopper on April 12, 2018, 08:43:55 AM
TTalma,
I'm curious.  Why do you want this in RPM and not in degrees?  Is it to figure out a good feedrate for your file?
Title: Re: My File is running real slow
Post by: Chaoticone on April 12, 2018, 11:14:04 AM
Chad, the problem is, you only have one feed rate at the time.
So say you have a line of Gcode that all axis are doing a synchronized feed move on (G1 F5 X5.000 Y5.000 Z5.000 A360.000).  All axis are going to end at the location requested at the same time.

Without the A axis this move would take 1 minute. But because of the A axis this line will take 360 degrees /5 degrees per minute = 72 minutes to complete.

However, using the same axes and values (G1 F5 X5.000 Y5.000 Z5.000 A360.000) but replacing the G1 with G93 and the F5 with F1 (G93 F1 X5.000 Y5.000 Z5.000 A360.000) it would finish in one minute............ assuming motor tuning would allow it to finish in the time of course. Now if any of the axis can't move the requested distance in the requested time (due to motor tuning) the time it would take will be extended to the fastest it can possibly happen in.

Hope that makes sense.
Title: Re: My File is running real slow
Post by: Cbyrdtopper on April 12, 2018, 12:30:49 PM
Brett,
That's pretty cool.  I get that, and this can actually be pretty useful on a couple machines we have here in the shop.  
I was just wondering why TTalma wanted RPM over Degrees.  
He wants to make Mach read in RPM no Degrees.  
I was curious why, exactly, does he want to do that.
Title: Re: My File is running real slow
Post by: RICH on April 12, 2018, 03:09:22 PM
Quote
He wants to make Mach read in RPM no Degrees.  I was curious why, exactly, does he want to do that.

Because he has a hard time relating to it and so do a lot of other folks.

IE;
Walk into candy store in a metric nation, request a  1/4 # of candy,
the waiter  says back to you ..... How many grams of candy? .......
DAHHHHHHHHHHHH you say 1750 grains......,
the  waiter replies how many  grams please .....
DAhhhhhhhhhhhhhh  you say .1 kilos.....,
waiter replies the scale is in grams only and again asks how many grams............,
DAhhhhhhhhhhhhhhh, frustrated you say.....  just fill my hand with candy and weigh it ! :D

ie; Another one
You buy a car and the tach reads in degrees per min!
What would be the first words that would appear in the bubble above a persons head?  ??? ;D

RICH
Title: Re: My File is running real slow
Post by: TTalma on April 12, 2018, 03:16:59 PM
Thanks for the updates. I need to change my way of thinking, when I do that it makes sense.

The main reason I want RPM's is because what I'm making (spiral patterns) the degrees don't really matter, I'm looking for how far my X axis will move for each revolution. I also plan to "wrap" flat models around the cylinder. So the circumference in inches matters to me as well.

And on that note after some more fiddling I was able to get my file working correctly (while thinking in degrees per min)

Thanks for all of the help.
Title: Re: My File is running real slow
Post by: Chaoticone on April 12, 2018, 05:37:53 PM
Well, I hesitate putting this up because it is a simple fix but comes with other issues. If you want the rotational axis to display and work in RPM instead of DPM just change your steps per in motor tuning to Current Steps Per X 360. This will break other things though like toolpath preview and most CAM programs wont generate code for it.

I maintain the proper fix is to use G93. And change your way of thinking of course. The above may be a fix for you but anyone reading this needs to make sure they understand that the real issue is your way of thinking. Just because you can do something doesn't mean you should. Mach like all other software is code. The code can be written to adapt to certain things but to an incorrect way of thinking is not a goal of any programmer I know. This is why standards and following them is so important.

No one should hate having to change their way of thinking to be on par with standards. No shame in it and you will be smarter for changing. Be happy that you are smarter than the machines today. That will not be the case much longer IMO. Today you can adapt your way of thinking to overcome obstacles keeping you from the desired end result. Most machines can't do that now. But when they can (and they will)....... we become useless eaters. So, take pride in your advantage today. It may not exist tomorrow.
Title: Re: My File is running real slow
Post by: Cbyrdtopper on April 12, 2018, 06:00:03 PM
HAHA.  Thanks Rich.  I mean I understand the difference in how you think about things.  I didn't know if it was that issue or if he NEEDED the RPM for something.  But I do like the analogies used.

I would also hesitate re-calibrating the motor.  Instead, I like Brett's idea of G93.  Elegant and accurate.

But, just for fun.  What would it entail to add a DRO to translate rotational RPM into RPM.  I think this could easily handled by the PLC Script.
Title: Re: My File is running real slow
Post by: Chaoticone on April 12, 2018, 06:03:38 PM
Quote
What would it entail to add a DRO to translate rotational RPM into RPM

Not sure what you meant here. RPM = RPM Maybe you meant DPM to RPM? Or maybe RPM to IPM?
Title: Re: My File is running real slow
Post by: Cbyrdtopper on April 12, 2018, 07:17:42 PM
Ha!   Didn't realize I did that
Yeah, the rotational feed into rpm.   The example earlier was 21,600 DPM = 60 RPM
Or IPM to RPM
Title: Re: My File is running real slow
Post by: joeaverage on April 12, 2018, 07:41:34 PM
Hi,
now get real and use radians per second like a proper physicist...

6.282 radians/sec =60 rpm LOL

Jokes aside, radians have value when you consider that the ratio of the circumference of the arc traversed to the cricumference
of the entire  circle is the angle in RADIANS.

Thus for OPs problem 1 inch on the surface of his 4 inch diameter job:
1/4 x pi=0.07959 radians which at 57 degree per radian=4.5 degrees.

So radians, an angular measurement has a direct correlation to surface circumference, its just the numbers look a bit weird.
Like 360 degrees = 2 x pi, 90 degrees= pi/2 and so on.

Craig
Title: Re: My File is running real slow
Post by: Cbyrdtopper on April 12, 2018, 07:46:23 PM
Radians.  Man, I had to teach myself what those were a couple years ago while making some conversational programs for Mach3 Lathe. 

That was some fun programming.
Title: Re: My File is running real slow
Post by: joeaverage on April 12, 2018, 07:50:57 PM
Hi,
when I start calculating things I always revert to radians. Like wise I tend to do all engineering and scientific
calculations in metric (MKS), even though I tend to present the result of the calculations in imperial like lbf
and pounds per square inch.

Craig
Title: Re: My File is running real slow
Post by: Chaoticone on April 12, 2018, 07:53:16 PM
You could put a dro on the screen and in the plc script look at one dro, do some math and set another dro to the product of the math. To convert RPM to IPM you would need a third dro to enter diameter or possibly look at machine cords of the depth axis and use its value in the math. It's the same as MPH changing with tire diameter while RPM stays the same.

An example can be found in the wxRouter screen. It takes decimal and converts them to fractional numbers in the DecToFrac function in the screen load script which is called by each of the decimal DROs On Update script. So, it is ran each time any decimal DRO value changes. The DecToFrac function writes the product to 3 labels for each axis instead of a single dro.
Title: Re: My File is running real slow
Post by: TTalma on April 16, 2018, 08:32:49 AM
Spent some time messing around with the G93 command. This makes sense. Basically time an instruction and let the machine figure feeds.

When i got looking at this more, I was thinking about the size of A. I am using a 4 inch diameter as my reference. But If I was using something larger the speed at the outer edge of the diameter would be much faster.
Title: Re: My File is running real slow
Post by: RICH on April 16, 2018, 07:16:45 PM
Yes, for a given time, the feed rate changes as the diameter varies, but, you'll limited depending on the other axis max velocity as compared to the A axis.
Study the chart that I posted. 

RICH