Calculate part cycle time from G-Code

Thank you for the help everyone, and cnc newbie here. I am looking to code an algorithm to estimate part cycle times from a specific machine. Is it possible to calculate cycle time just from a G-Code file? If not, do I need to obtain specifications of the machine in question (like interpolation rates, axis movement times, etc) plus the G-Code to make that calculation? Or is my only hope is to empirically measure and estimate after it has run a few times on the machine?

If I need to do measure cycle time empirically aren’t there G-Code simulators that can estimate cycle time? If so, how do they do it?

Thank you for the help.

Josh

Only 3 things affect cycle time, that I can think of. Feed rate/distance traveled, pauses, and tool changes. Only the last one is machine dependent, but there usually aren’t that many of them.

I take that back: Rapid speeds are also machine dependent.

Thank you for the reply @bgangwere. Do you have any thoughts how the specific stock material plays a role. That isn’t specified in the G Code right?

It won’t make any difference in analyzing the cycle time from the g-code.

Doesn’t it mak a difference because different materials may have different feed rates?

I think @bgangwere is getting at the fact that the material specific f&s will be specified in the g code, IIRC

Doesn’t make any difference because it doesn’t affect the cycle time of a specific g-code program. Softer material can be milled faster, but that will be evidenced by different g-code, specifically in the speeds and feeds.

Okay, then I don’t understand the OP’s question.

Take a look at how octoprint and pronterface get their time estimates, or look at any other open source 3d printer controller. They use gcode so it should be the same idea

1 Like

From the complaints I hear, Octoprint may not be a good example of how to estimate job time…

Eh, everyone complains about something now days.

Octoprint progressively looks at the gcode and updates the estimate as it goes. The 3d printers use a built in layer time that makes all the layers take the same time so the plastic fuses completely, it does this by making the machine go slower for smaller layers and faster for larger layers.

I think the estimate is being pulled from a very small sample of the gcode speeds and not the gcode as a whole, so people get varied speed results.

I think I understand. Since the G Code specifies the feed and speeds it is up the machine to stick to that setting by the amount of power applied to the spindle, etc. So while the cycle time should remain consistent for wood version steel material the amount of power to complete the cycle should vary. Is that the right way of thinking about it?

Nothing affects the power provided to the spindle. A 10" cut at 200 IPM will take 3 seconds regardless of the machine. (Note: this example is not realistic.) If it doesn’t have the spindle horsepower the tool will stall and/or break, but that has nothing to do w/ calculating the cycle time. If you’re talking about a lack of power to drive the axes, that’s bad g code.

1 Like

I just want to summarize where I think this discussion has gone.
These are the thing which affect “part cycle time” (from a CNC Milling perspective, primarily, but should be largely translative)

  1. Rapid speeds (NOT in gcode. Moving the tool from where it is now to where it needs to be to start the next step; this should be predictable per machine, but not part of the gcode necessarily, as I think it just tells the machine to move from coordinate 0 to coordinate 1; how fast that happens will depend on the machine rather than the gcode)
  2. Feed rate (In gcode. Will depend on the tool, material, machine, and operation, but should be configured in the gcode)
  3. Distance travelled (In gcode. Will depend on the tool, material, machine, and operation but should be configured in the gcode)
  4. Pauses (In gcode.)
  5. Tool changes (NOT in gcode. Will be highly machine dependant and rapid speeds will again play a huge role. This should still be predictable for a given machine.)

Please correct these where I’m wrong. Hopefully this is helpful to someone (OP) other than me…
Doesn’t this usually happen when you crank your input through the gcode generator (to oversimplify it, e.g. doesn’t FeatureCAM offer time estimates if you put a CAD file in for processing)?

1 Like

FeatureCAM does estimate times. But he’s trying to analyze the g code.

1 Like

Thank you @jast, and this is tremendously helpful to me. @bgangwere is correct to state that I am just trying to look at G-Code and make estimates from that. From yours and everyone else’s posts it is clear I need to include machine specifications to make any accurate estimate.

1 Like

Ah I understand now, and see why it’s so important to have the right F&S to the material setup upfront.

Lastly, I am curious if there are machines that automatically change F&S rates based on the performance of the cuts or that is that too dangerous of an operation to do on the fly? Plus, it would take a deep knowledge of the tool, material and part design to make the appropriate adjustments which is why simulating beforehand in software is the best option. Just curious.

Thanks again for the help!