Skip to content

How does it work?

Eyal edited this page Sep 26, 2019 · 5 revisions

How does it work?

In short, Genius uses more precise gcode analysis to better estimate the remaining print time. To understand how, you first need to understand how OctoPrint's built-in analysis works.

How OctoPrint analysis works

First, OctoPrint analyzes the gcode line-by-line and adds up all the time spent, based on the distance traveled and the rate of travel. Add all those up and get the estimated time to print.

Then, while printing, subtract the print time so far from the estimated total print time and that is the remaining print time:

reamining print time = total print time - print time so far

After printing for a while, OctoPrint can make a new estimate based on the printing so far. OctoPrint will assume that if, for example, 30% of the file has been printed, then the remaining time can be extrapolated from assuming that the print is 30% done.

remaining print time = print time so far * (1 - \frac{1}{progress})

Why OctoPrint analysis doesn't work well

  • It assumes that OctoPrint's estimated print time is accurate. It isn't. OctoPrint analysis doesn't take jerk, max speed, or acceleration rates into account.
  • It assumes that the remaining time can be extrapolated. For some prints, being 30% of the way through the file might actually mean 30% of the print time has passed. But for most files, this isn't true. In the graph below, we see OctoPrint's estimate for total print time versus the actual print time versus the Genius estimate. chart
  • It doesn't take heat-up or cool-down times into account.

How PrintTimeGenius estimates print time

  1. PrintTimeGenius first runs the built-in estimate.
  2. Next it looks through the source code for comments that slic3r, cura, or Simplify3D may have put in there about filament length, volume, and print time.
  3. Finally, it runs a Marlin simulation and calculates how long printing will take. The simulation uses the same code that Marlin firmware uses. It takes jerk, acceleration, and other print settings into account. It takes those settings from the printer itself, which reports them when running M503. (OctoPrint automatically runs M503 when starting up.)

This lets PrintTimeGenius make a better estimate for the total print time than OctoPrint's analysis.

How PrintTimeGenius reports remaining print time.

The Marlin simulator, in addition to reporting total print time, also reports the remaining print time at each line in the file. The plug-in stores this for each file. For example, it might report that when we're 30% of the way through the gcode, already 50% of the print time is done. This could be because the first 30% of the file had really big moves.

When this progress info is available, PrintTimeGenius displays a gold star (★) next to the print time remaining.

PrintTimeGenius compensation

Heat-up time and cool-down time isn't known when simulating. Also, we might have a systematic error in the simulation where all simulations are off by, for example, a factor of 5%. PrintTimeGenius tries to compensate for those.

How PrintTimeGenius compensates

PrintTimeGenius divides the printing into 3 sections:

  1. Heating: Everything until the first filament comes out of the extruder, including homing.
  2. Extruding: From the end of heating until no more filament comes out of the extruder.
  3. Cooling: From the end of extruding until the print is done, including moving the extruder out of the way and moving the platform to cool.

After each successful print, the estimate and actual are recorded. The most recent five prints are saved. PrintTimeGenius uses those to compensate the estimated print time like this:

  1. The average heating time replaces the estimated heat-up time.
  2. The extruding time is scaled to compensate for errors. For example, if actual extruding is slower than estimated by 5% then take 5% off the estimate.
  3. The average cooling time replaces the estimated cooling time.

The compensated values are the ones actually reported. They can be viewed as a table in the settings.