Coder Social home page Coder Social logo

klipper_estimator's Introduction

Klipper print time estimator

klipper_estimator is a tool for determining the time a print will take using the Klipper firmware. Currently it provides the following modes:

  • estimate mode outputs detailed statistics about a print job
  • post-process mode can be used as a Slicer post-processing script, updating the gcode output file with corrected time estimates.
  • dump-moves mode dumps planning data for every move in a file

The estimation is done using an implementation of Klippers kinematics, but may in some cases be slightly off due to rounding modes. If the timing is far off(e.g. more than a minute over a >12 hour print), this is considered a bug.

Note that currently delta kinematic limits are not implemented.

Getting klipper_estimator

Pre-built binaries are available for the latest release on the GitHub Releases page. If you wish to build the tool yourself or poke around the source, see the Building section.

Binaries are provided for Windows, Linux, Mac OS X, and Raspberry Pi targets. On Linux and Mac OS X, ensure that you give the downloaded file executable permissions. This can be done in the terminal as follows:

$ chmod +x klipper_estimator

Change the filename (last parameter) to match the downloaded file.

For Arch Linux, an AUR package klipper_estimator is available, courtesy of Wilhelm Schuster. Thanks!

Usage

Basic usage info can be found by running klipper_estimator with no arguments.

Configuration

In order to provide accurate times, klipper_estimator needs printer settings including maximum velocity, acceleration, etc. It can take these either from a config file(--config_file option) or grab them directly from Moonraker(using the --config_moonraker_url option and, if authentication is required, --config_moonraker_api_key). Note that the Klipper configuration files cannot be used directly.

To experiment with settings, one can use the dump-config command together with --config_moonraker_url to generate a config file based on the current printer settings. The config file can then be modified and used as input for the other commands.

To dump a config, use e.g.:

$ ./klipper_estimator --config_moonraker_url http://192.168.0.21 dump-config > config.json

The config file format is Json5 and thus allows normal JSON with some extensions(see https://json5.org/).

After generating a config, one can use this in other commands like so:

$ ./klipper_estimator --config_file config.json estimate ...

Quirks

Be aware of the following "quirks" when using klipper_estimator compared to Klipper itself:

Relative extrusion by default

klipper_estimator assumes relative extrusion and absolute movement by default. This is different from Klipper, which assumes absolute extrusion as well. This difference exists because klipper_estimator can't see inside macros. Most users use relative extrusion, and put the M83 command in their print start macro, making it invisible to klipper_estimator.

If you wish to use absolute extrusion, you must ensure that an M82 command is inserted in your slicer start gcode. E.g.:

PRINT_START
M82

estimate mode

Estimation mode is useful for determining statistics about a print, in order to optimize print times. It gives a high level summary.

Basic usage:

$ ./klipper_estimator [config options] estimate ~/3DBenchy.data
Sequences:
 Run 0:
  Total moves: 42876
  Total distance: 73313.01640025008
  Total extrude distance: 3407.877500000097
  Minimal time: 1h29m9.948s (5349.947936969622)
  Average flow: 1.5321468696371368 mm3/s
  Phases:
    Acceleration: 27m4.291s
    Cruise:       35m1.116s
    Deceleration: 27m4.291s
  Moves:
  Layer times:
         0 => 2.536s
         ... [some lines omitted for brevity]
        48 => 4.834s
  Kind times:
   4m23.463s            => FILL
   2.639s               => Other
   18m0.185s            => SOLID-FILL
   28m29.706s           => WALL-INNER
   38m13.706s           => WALL-OUTER

The calculations are done based only on the commands found in the file, with no regards for macro expansions. This means that print_start type macros will count as zero seconds, as well heat up times, homing, etc. Therefore the time output should be considered a "minimal time", assuming these extra factors take no time.

post-process mode

In post-process mode klipper_estimator directly modifies the filename passed in in-place, updating time estimations in the file.

When using klipper_estimator in post-process mode, simply add a post-processing script in your slicer like so:

/path/to/klipper_estimator --config_moonraker_url http://192.168.0.21 post-process

Change the path and config options to fit your situation.

Currently the following slicers are supported:

  • PrusaSlicer
  • SuperSlicer
  • OrcaSlicer
  • ideaMaker
  • Cura
  • Simplify3D

In PrusaSlicer, SuperSlicer, and OrcaSlicer Post-processing scripts are set in Output Options under Print Settings:

PrusaSlicer, Orcaslicer, and SuperSlicer Post-processing scripts option

Note that ideaMaker does not have support for post-processing scripts, and thus cannot automatically run klipper_estimator on export.

For Cura, using klipper Preprocessor is recommended. See their git repository for information on how to set up this tool.

In Simplify3D the relevant estimation command must be added under Scripts in the Additional terminal commands for post processing field. This field is just called Post Processing in V5.x, and the command should be appended with a [output_filepath].

/path/to/klipper_estimator --config_moonraker_url http://192.168.0.21 post-process [output_filepath]

dump-moves mode

The dump-moves mode is used like estimate mode, but instead of providing a summary, move planning data is dumped for every move.

Accurately estimating PRINT_START/PRINT_END macros

Klipper macros can perform arbitrarily complex operations. klipper_estimator has no hope of estimating how long these will take, as the Jinja templates can access any state of the read printer. However it is often the case that the amount of print time actually spent within the macro is constant. A prime example of this is print start macros. The macro may execute homing and heating commands, but the print timer does not start until the first material is extruded. This generally happens when the prime line is started.

This gives rise to an offset in print time that we cannot estimate, but the user can easily measure it after a print is over.

To compensate for this, klipper_estimator understands the following gcode comment(generally syntax followed by some examples):

; ESTIMATOR_ADD_TIME <duration, seconds> [description]
; E.g.:
; ESTIMATOR_ADD_TIME 21
; ESTIMATOR_ADD_TIME 21 Print start

When klipper_estimator encounters a comment with this format, it will add the requested duration to the total print time. The time will also be tracked as a "move kind", if the description field is given.

Note that only the upper-case string ESTIMATOR_ADD_TIME, on a separate comment line, will trigger this behaviour. Any whitespace between the ; and E characters will however be ignored.

The intended usage of this functionality is for print start macros, when executed by the slicer. E.g. in PrusaSlicer, SuperSlicer, or OrcaSlicer, one might set their print start gcode like this:

; ESTIMATOR_ADD_TIME 20 Prime line
print_start extruder=[first_layer_temperature] bed=[first_layer_bed_temperature]

Building

klipper_estimator is written in Rust. Version 1.58 or newer is required to compile the tool. Assuming a Rust toolchain is installed, along with git, one can build klipper_estimator by running:

$ git clone https://github.com/dalegaard/klipper_estimator.git
$ cd klipper_estimator
$ cargo build --release
// Resulting binary will be at `target/release/klipper_estimator`(.exe on Windows)

Acknowledgements

This project is in no way endorsed by the Klipper project. Please do not direct any support requests to the Klipper project.

klipper_estimator's People

Contributors

coffee0297 avatar dalegaard avatar garethky avatar jtrmal avatar mikebcbc avatar ollien avatar pedrolamas avatar solidrobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

klipper_estimator's Issues

ParseError with macros using leading underscore

To help keep my macro menu uncluttered I have leading underscores on a lot of my macros including the start/end macros (_START_PRINT and _END_PRINT). When attempting to use klipper_estimator it throws an error if these macros are used:

thread 'main' panicked at 'gcode read: ParseError(GCodeParseError { position: "_START_PRINT BED_TEMP=70 EXTRUDER_TEMP=215" })', tool\src\cmd\estimate.rs:202:27

If I remove the leading underscores and just call them "START_PRINT" and "END_PRINT", the parse runs correctly.

Using a freshly-built copy of klipper_estimator 2.0.4 on Windows 10; slicer is SuperSlicer 2.5.59.0.

FR: Output corrected printtime to filename

The postprocess mode works perfectly but I usually glance at the file name that is outputted by the slicer to gauge the print times. Can there be an option added to append the print time to the file name?

Simplyfi3D Support

Simplyfi3D seem not to work, dont see the correct times in Mainsail and at the end from gcode i see this line:

; Processed by klipper_estimator v3.0.0, no slicer detected

One-off error in `OperationSequence::process`?

There is some things that I don't understand in klipper_estimator OperationSequence::process:

As I understand it, on a partial flush, the loop looks in reverse order for a move with an entry velocity that doesn't depend on the following moves. This will act as the starting point for propagating peak velocity to previous moves. When such move can't be found in the unplanned part of the buffer, nothing is done or yielded downstream.

When this search reaches an non-move operation which is also the first unplanned operation, it sets flush_count to its index. This enables the operation to be readily yielded by next_move. At least, I think this is the intent of this code.

Now the issue is that self.flush_count + 1 is actually the index of the second operation in the unplanned part of the buffer.

Another thing that I noticed: when the search can't find starting point for planing, self.flush_count is set to 0, which will plan again the moves at the start of the buffer. Not sure if this intended, but otherwise, the old value should be left alone.
Your implementation also recompute the planning of all moves during a complete flush (!partial), I don't think the original implementation does this.

Maybe I'm missing something, this literal translation from optimized python was quite difficult for me to grasp...

Klipper Estimator does weird post-processing things with Linear Advance in Cura

As the title says, I get a weird diff when I compare the pre-processed and the post-processed files with klipper estimator when using in conjunction with FieldOfView's Linear Advance plugin. In particular, it seems like Klipper estimator is moving around the order of the linear advance command in an odd fashion according to this diff at the beginning of the file. Is there a reason why?

image

resolving .local?

Hi, I'm kinda unsure what's wrong in this case. I can ping the computer without any troubles and log to the machine as well. When I use the config_moonraker_url with IP address, all works, but when I use the mDNS name, it seems it does not work and the error is not exactly providing info I could use to troubleshoot this. Any suggestion/advice? I'm using latest release...

$ klipper_estimator_osx --config_moonraker_url http://192.168.250.222 dump-config
{
  "max_velocity": 200.0,
  "max_acceleration": 3000.0,
  "max_accel_to_decel": 1500.0,
  "square_corner_velocity": 8.0,
  "instant_corner_velocity": 1.0,
  "move_checkers": [
    {
      "axis_limiter": {
        "axis": [
          0.0,
          0.0,
          1.0
        ],
        "max_velocity": 100.0,
        "max_accel": 500.0
      }
    },
    {
      "extruder_limiter": {
        "max_velocity": 53.21621607382886,
        "max_accel": 798.2432411074329
      }
    }
  ],
  "firmware_retraction": {
    "retract_length": 0.6,
    "unretract_extra_length": 0.0,
    "unretract_speed": 30.0,
    "retract_speed": 30.0
  }
} 

$ ping vsw.local
PING vsw.local (192.168.250.222): 56 data bytes
64 bytes from 192.168.250.222: icmp_seq=0 ttl=64 time=8.989 ms
^C
--- vsw.local ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 8.989/8.989/8.989/0.000 ms

$ klipper_estimator_osx --config_moonraker_url http://vsw.local dump-config
Failed to load printer configuration: request failed: error decoding response body: missing field `result` at line 1 column 580

FR: Timelapse Evaluation

I notice that if I estimate a file with and without the "TIMELAPSE_TAKE_FRAME" macro after every layer, the estimates are the same. Would it be possible to estimate the time spent doing this. I know there are some variables in klipper which configure how fast to move, and how long to wait. It would be really cool to be able to see how long the time lapse is adding to a print, and create even more accurate time estimates for the full print.

If I am incorrect and this is accounted for, I apologize. I just installed this and it is amazingly better than what I was getting for estimates before. Thanks for your great work!

Integrate kilpper estimator into OctoPrint-PrintTimeGenius plugin

Maybe now that this estimator exists, it can be possible to integrate into the PTG plugin?

From what I read about the kilpper estimator, the only major change that would be needed is a mode where kilpper estimator can output the mapping from file position to time. That is: when Klipper is processing file byte X, Y second have elapsed since the start of the print. Output as many of these as you like. This is how the marlin estimator works.

PTG already gathers information from the printer like the speeds and feeds. Those can be provided to the estimator by PTG.

Klipper estimation is a feature that many users have requested.

Let me know if you'd be interested in working on this together.

Setup instructions for MacOs

I'm on MacOs (intel) and I'm really confused on how to use this.
The compiled osx file comes as a word document, not an executable.

Below is the error when I try to post-process in SuperSlicer.

Post-processing script /Users/victorlazaro/Klipper/klipper_estimator_osx --config_moonraker_url http://192.168.68.118 post-process on file /var/folders/_l/pjyt202j6xn5l7jx__8v7kl80000gn/T/.39849.gcode.pp failed.
Error code: 126
Output:
zsh:1: permission denied: /Users/victorlazaro/Klipper/klipper_estimator_osx

Massive overestimate of print time

I tried to use klipper_estimator and every gcode file I gave it resulted in a very overestimated print time.

For instance, this gcode file gcode file was printed in 6h13m (6h18m total time) yet klipper_estimator_linux --config_moonraker_url http://chiron.frnchfrgg.pw estimate file.gcode says:

  Total moves:                 527354
  Total distance:              1495631.625mm
  Total extrude distance:      43868.467mm
  Minimal time:                9h9m25.656s (32965.656s)
  Total print move time:       8h6m27.482s (29187.482s)
  Total extrude-only time:     27m45.877s (1665.877s)
  Total travel time:           35m11.847s (2111.847s)

chiron.frnchfrgg.pw is not accessible from outside my LAN but here is the result of
klipper_estimator_linux --config_moonraker_url http://chiron.frnchfrgg.pw dump-config:

{
  "max_velocity": 300.0,
  "max_acceleration": 1200.0,
  "max_accel_to_decel": 600.0,
  "square_corner_velocity": 5.0,
  "instant_corner_velocity": 1.0,
  "move_checkers": [
    {
      "axis_limiter": {
        "axis": [
          0.0,
          0.0,
          1.0
        ],
        "max_velocity": 20.0,
        "max_accel": 60.0
      }
    },
    {
      "extruder_limiter": {
        "max_velocity": 79.82432411074329,
        "max_accel": 319.29729644297316
      }
    }
  ]
}

These values match the klipper configuration I use. If needed I can attach parts of said klipper configuration.

Note that klipper_estimator should probably give an estimate between 5h50m and 6h instead because I use a timelapse which adds at least 3 seconds per layer, and I did not yet try to add accounting for that.

Wrong max_accel_to_decel calculation in v3.7.x

Hi,

since klipper config changed to minimum_cruise_ratio, the estimation calculation is still wrong (before it was perfect).

So either interpret minimum_cruise_ratio (in this case the default of 0.5) correctly or calculate the old max_accel_to_decel as max_accel_to_decel = max_acceleration * minimum_cruise_ratio

In my example it's set to "max_accel_to_decel": 50.0 instead of "max_accel_to_decel": 1750.0

my relevant printer.cfg:

[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 3500 
#minimum_cruise_ratio: 0.5  # default
max_z_velocity: 30  
max_z_accel: 500

a short : .\klipper_estimator.exe --config_moonraker_url http://192.168.40.6 dump-config reveals the issue

{
  "max_velocity": 500.0,
  "max_acceleration": 3500.0,
  "max_accel_to_decel": 50.0,
  "square_corner_velocity": 5.0,
  "instant_corner_velocity": 1.0,
  "firmware_retraction": {
    "retract_length": 1.0,
    "unretract_extra_length": 0.0,
    "unretract_speed": 40.0,
    "retract_speed": 40.0
  },
  "mm_per_arc_segment": 0.1,
  "move_checkers": [
    {
      "axis_limiter": {
        "axis": [
          0.0,
          0.0,
          1.0
        ],
        "max_velocity": 30.0,
        "max_accel": 500.0
      }
    },
    {
      "extruder_limiter": {
        "max_velocity": 165.0,
        "max_accel": 931.2837812920052
      }
    }
  ]
}

So current time estamination are way to long

Best regards
freakyDude

Logging

Hi,

Is the use of Klipper_estimator in post process mode logged anywhere? I’m not sure it’s working on my setup and wanted to check a log to see what’s happening.

Thanks.

Display Popup Window with Estimate after Slicing/Export / Possible bug in layer time output

I'm currently doing speed Benchies and your simulator has been super insightful in understanding what is going on in terms of flow and estimating the total time it will take to print / where time is spent.
I'm using Orca and couldn't find a way to just pop-up a window with the estimate after slicing, look at it and make decisions based on what I'm seeing in terms of the additional data I'm getting now.

So I made this PowerShell wrapper that does exactly that. It practically avoids a lot of wasted filament and time, streamlining the workflow to a point that is near perfect, because one can avoid all this physical testing when changing this one thing the slicer that one thinks might make it go faster. We can simulate everything now! :-)
I had a lot of problems with spaces in file system paths while doing this, it fixes all that as well.

Feel free to release this along with the project, it works great and should work in all slicers I think.

Why this is an issue?
There seems to be a bug in the output of the simulator. I also wanted to capture the output and write it next to g-code file in addition to displaying it, so I can look at it later. This works but only up until the:
!!! Layer Time Distribution !!! is printed.
For some reason, no matter what I tried in PowerShell or simple CMD, as soon as you pipe the output into a file, it hangs up the process at that very point.
I suspect there is a stream, or a pipe not being closed properly in the layer time distribution output.
It works fine against a console, but as soon as you try to capture the output in any shape or form it hangs up on the last part being written.

Suggestions:
Either fix why this is happening or provide a switch that causes the layer time distribution to NOT print.
Some switches in general to control which sections are printing would be awesome in this use case, I personally don't care much about the layer distribution (which can be quite long and causes the pop up window to scroll up, having to scroll back to the top).

Hope this helps :-)
Mac

Run_Klipper_Estimator.zip

image

Microsoft Defender says: Trojan:Win32/Wacatac.B!ml

Hi,

I don't know if it is a temporary problem ... but at the moment the Win11 Microsoft defender says the current klipper_estimator.exe (v 3.7.0) has a Trojan:Win32/Wacatac.B!ml and quarantains the file

grafik

With best regards,
freakyDude

FR: Add time offset to account for print_start

Since klipper estimator can't expand macros like print_start, but at least kinematicly they should always take the same amount of time. I suggest an option to add a fixed number of seconds to the estimate to account for macros. This could either be a command line option or possibly a gcode comment.

This would be most useful for post processing accuracy.

It would still be up to the user to measure the time offset they need, but they wouldn't need to change it unless they changed their print_start.

I'm not aware of a command for klipper to save or output the time elapsed since the beginning of a print. But if it exists, you could add that command to the end of your print_start and automatically capture the offset needed for the user to later give to klipper estimator.

Time estimate way above actual time

I wanted to test out klipper_estimator so I downloaded a few already printed gcode files and ran them through the estimate function. They all estimated longer than they actually took and some were a large amount longer. For example:

I first ran klipper_estimator--config_moonraker_url $IP_ADDRESS dump-config > config.json which produced the following file:

{
  "max_velocity": 300.0,
  "max_acceleration": 3000.0,
  "max_accel_to_decel": 1500.0,
  "square_corner_velocity": 5.0,
  "instant_corner_velocity": 1.0,
  "move_checkers": [
    {
      "axis_limiter": {
        "axis": [
          0.0,
          0.0,
          1.0
        ],
        "max_velocity": 5.0,
        "max_accel": 100.0
      }
    },
    {
      "extruder_limiter": {
        "max_velocity": 79.82432411074329,
        "max_accel": 798.2432411074329
      }
    }
  ]
}

I then ran klipper_estimator --config_file ./config.json estimate file.gcode which produced the following output:

Sequences:
 Run 0:
  Total moves:                 1694398
  Total distance:              2257241.611mm
  Total extrude distance:      28255264.679mm
  Minimal time:                1d8h23m41.648s (116621.648s)
  Total print move time:       1d6h21m21.750s (109281.750s)
  Total extrude-only time:     48m39.994s (2919.994s)
  Total travel time:           1h13m39.654s (4419.654s)
  Average flow:                582.755 mm³/s
  Maximum flow:                229638.109 mm³/s
  Average flow (output only):  621.896 mm³/s
  Phases:
   Acceleration:               11h47m18.438s
   Cruise:                     8h34m2.780s
   Deceleration:               12h2m20.180s
  Move kind distribution:
   13h6m0.391s      Internal infill
   6h9m28.506s      External perimeter
   5h45m1.344s      Internal perimeter
   2h59m47.195s     Solid infill
   2h25m27.437s     Support material
   1h10.255s        Support material interface
   25m16.625s       Top solid infill
   17m18.856s       Overhang perimeter
   14m49.282s       Internal bridge infill
   19.400s          Bridge infill
   2.108s           Custom
  Layer time distribution:
    0.000:     0.076s    10.600:  3m19.389s    21.040:    38.062s    28.240:    31.382s    37.440:    23.301s    47.750:    12.100s    54.950:     7.361s    62.750:     8.264s    72.200:  3m10.999s
    0.200: 30m32.523s    10.640:    53.701s    21.200:  3m11.667s    28.350:    31.103s    37.600:  2m59.335s    47.800:   3m9.284s    55.000:   3m7.015s    62.800:  3m16.415s    72.400:  3m16.809s
    0.240:   1m2.231s    10.800:  3m19.681s    21.240:    35.574s    28.400:  3m11.635s    37.640:    23.939s    47.840:    13.485s    55.040:     8.685s    62.840:     8.973s    72.600:  3m12.059s
    0.400: 17m18.260s    10.840:    51.164s    21.400:   3m4.793s    28.440:    30.695s    37.800:   3m3.030s    47.950:    12.168s    55.150:     7.513s    62.950:     7.139s    72.680:     3.245s
    0.440:   1m4.467s    11.000:  3m18.593s    21.440:    37.577s    28.550:    30.387s    37.840:    23.692s    48.000:   3m7.414s    55.200:   3m4.258s    63.000:   3m8.729s    72.800:   3m8.036s
    0.600: 17m12.258s    11.040:    53.182s    21.600:  2m48.304s    28.600:  3m15.199s    38.000:   3m1.149s    48.040:    13.606s    55.240:     7.684s    63.040:     7.550s    72.960:     4.302s
    0.640:   1m5.402s    11.200:  3m18.123s    21.640:    34.655s    28.640:    30.278s    38.040:    25.661s    48.150:    13.331s    55.350:     7.999s    63.150:     5.994s    73.000:   3m4.947s
    0.800: 17m20.370s    11.240:    51.668s    21.750:    35.414s    28.750:    30.088s    38.200:   3m6.953s    48.200:  3m18.199s    55.400:  2m56.007s    63.200:  3m10.204s    73.200:  2m55.668s
    0.840:   1m3.650s    11.400:  3m10.730s    21.800:  2m47.276s    28.800:  3m21.030s    38.240:    25.210s    48.240:    13.704s    55.440:     7.609s    63.240:     5.875s    73.250:     4.418s
    1.000: 12m31.717s    11.440:    53.219s    21.840:    33.903s    28.840:    29.806s    38.400:  3m16.416s    48.350:    13.675s    55.550:     8.084s    63.350:     6.163s    73.400:  2m57.783s
    1.040:   1m4.006s    11.600:   3m1.883s    21.950:    35.520s    28.950:    29.484s    38.440:    25.221s    48.400:  3m18.089s    55.600:   3m3.991s    63.400:   3m6.984s    73.440:     4.674s
    1.200: 12m51.274s    11.640:    51.382s    22.000:  2m47.996s    29.000:  3m19.031s    38.600:  3m12.874s    48.440:    13.547s    55.640:     8.333s    63.440:     5.590s    73.600:  2m58.406s
    1.240:   1m2.897s    11.800:  2m59.182s    22.040:    34.080s    29.040:    29.513s    38.640:    25.106s    48.550:    14.041s    55.750:     7.688s    63.550:     6.605s    73.640:     4.009s
    1.400: 12m14.962s    11.840:    52.391s    22.150:    34.878s    29.150:    29.340s    38.800:  3m20.478s    48.600:  3m23.656s    55.800:  2m54.314s    63.600:   3m7.909s    73.800:  2m55.748s
    1.440:   1m3.442s    12.000:   3m2.999s    22.200:  2m51.214s    29.200:  3m14.559s    38.840:    25.731s    48.640:    13.698s    55.840:     8.503s    63.640:     6.351s    73.840:     5.203s
    1.600: 11m18.779s    12.040:    50.249s    22.240:    33.407s    29.240:    29.187s    39.000:  3m18.198s    48.750:    14.560s    55.950:     7.611s    63.750:     6.395s    74.000:   3m4.825s
    1.640:   1m1.253s    12.200:   3m4.105s    22.350:    35.074s    29.350:    28.805s    39.040:    26.386s    48.800:  3m17.975s    56.000:   3m1.189s    63.800:   3m1.175s    74.040:     3.236s
    1.800: 10m33.462s    12.240:    51.478s    22.400:  2m50.529s    29.400:  3m11.585s    39.200:  3m13.052s    48.840:    13.426s    56.040:     8.442s    63.950:     8.720s    74.200:   3m7.849s
    1.840:   1m3.243s    12.400:  3m10.034s    22.440:    33.452s    29.440:    29.015s    39.240:    24.888s    48.950:    14.051s    56.150:     8.112s    64.000:   3m5.334s    74.240:     3.027s
    2.000: 10m19.126s    12.440:    49.009s    22.550:    34.699s    29.550:    28.273s    39.400:   3m8.723s    49.000:  3m12.706s    56.200:   3m4.864s    64.150:     8.706s    74.400:  3m13.192s
    2.040:   1m1.614s    12.600:  3m15.251s    22.600:  2m55.262s    29.600:   3m1.226s    39.440:    24.714s    49.040:    12.998s    56.240:     7.799s    64.200:   3m8.885s    74.440:     2.939s
    2.200: 10m36.336s    12.640:    50.247s    22.640:    33.127s    29.640:    28.531s    39.600:   3m7.574s    49.150:    13.318s    56.350:     8.077s    64.350:     9.824s    74.600:  3m14.663s
    2.240:   1m3.206s    12.800:  3m15.144s    22.750:    34.459s    29.750:    28.747s    39.640:    21.479s    49.200:   3m7.563s    56.400:   3m8.976s    64.400:  3m11.772s    74.640:     1.223s
    2.400:  12m0.033s    12.840:    49.430s    22.800:  2m56.012s    29.800:   3m6.880s    39.800:   3m9.966s    49.240:    13.244s    56.440:     7.322s    64.600:  3m11.873s    74.800:  3m16.771s
    2.440:   1m1.711s    13.000:  3m13.289s    22.840:    33.100s    29.840:    27.988s    39.840:    21.187s    49.350:    13.950s    56.550:     8.042s    64.670:     8.478s    75.000:  3m11.633s
    2.600: 12m20.908s    13.040:    50.230s    22.950:    34.071s    29.950:    27.822s    40.000:   3m8.143s    49.400:  2m59.646s    56.600:  3m16.239s    64.800:   3m6.386s    75.200:   3m2.730s
    2.640:   1m2.404s    13.200:  3m12.174s    23.000:  2m58.335s    30.000:   3m0.515s    40.040:    19.489s    49.440:    13.500s    56.640:     7.623s    64.950:     6.485s    75.400:   3m5.176s
    2.800:  13m5.527s    13.240:    49.076s    23.040:    33.321s    30.040:    28.056s    40.200:  3m16.700s    49.550:    13.529s    56.750:     8.049s    65.000:   3m3.090s    75.600:   3m4.172s
    2.840:   1m1.311s    13.400:   3m6.887s    23.150:    33.926s    30.150:    28.975s    40.240:    19.471s    49.600:   3m1.219s    56.800:   3m5.340s    65.200:  2m59.066s    75.800:   3m0.405s
    3.000: 13m46.720s    13.440:    49.548s    23.200:  2m54.003s    30.200:   3m9.532s    40.400:  3m17.664s    49.640:    12.967s    56.840:     8.622s    65.270:     6.487s    76.000:   3m3.958s
    3.040:   1m1.739s    13.600:  2m56.814s    23.240:    32.592s    30.240:    28.413s    40.440:    19.535s    49.750:    13.167s    56.950:     8.101s    65.400:  2m54.982s    76.200:   3m9.642s
    3.200: 12m49.088s    13.640:    48.241s    23.350:    33.300s    30.350:    28.565s    40.600:  3m19.855s    49.800:   3m0.969s    57.000:   3m3.060s    65.550:     6.821s    76.400:  3m14.438s
    3.240:   1m0.687s    13.800:   3m2.161s    23.400:  2m48.641s    30.400:  3m10.524s    40.640:    18.742s    49.840:    13.154s    57.040:     8.494s    65.600:  2m54.564s    76.600:   3m8.613s
    3.400:  12m3.053s    13.840:    49.559s    23.440:    31.443s    30.440:    28.367s    40.800:  3m17.577s    49.950:    12.504s    57.150:     8.112s    65.800:  2m57.104s    76.800:   3m6.112s
    3.440:   1m2.131s    14.000:   3m3.359s    23.550:    32.568s    30.550:    28.456s    40.840:    18.748s    50.000:   3m6.812s    57.200:  2m59.487s    65.850:     7.085s    77.000:   3m2.634s
    3.600: 11m45.526s    14.040:    48.283s    23.600:  2m41.540s    30.600:  3m12.032s    41.000:  3m15.297s    50.040:    12.105s    57.240:     8.295s    66.000:   3m4.789s    77.200:  2m53.930s
    3.640:   1m0.023s    14.200:   3m2.708s    23.640:    31.334s    30.640:    28.709s    41.040:    18.573s    50.150:    11.419s    57.350:     8.174s    66.040:     6.296s    77.400:  2m57.188s
    3.800: 11m26.965s    14.240:    49.409s    23.750:    32.400s    30.750:    28.161s    41.200:   3m9.175s    50.200:   3m8.110s    57.400:  2m51.758s    66.200:   3m9.481s    77.600:  2m57.747s
    3.840:   1m1.267s    14.400:  3m13.836s    23.800:  2m55.708s    30.800:  3m22.865s    41.240:    18.015s    50.240:    10.944s    57.440:     8.488s    66.240:     6.776s    77.800:  2m58.840s
    4.000:  11m8.958s    14.440:    48.351s    23.840:    31.622s    30.840:    29.551s    41.400:   3m3.591s    50.350:    10.646s    57.550:     8.211s    66.400:  3m10.160s    78.000:   3m1.735s
    4.040:    59.553s    14.600:  3m14.347s    23.950:    32.093s    31.000:  3m14.859s    41.440:    18.177s    50.400:  3m16.196s    57.600:  2m54.417s    66.440:     6.818s    78.200:   3m7.238s
    4.200: 17m42.171s    14.640:    49.015s    24.000:  2m55.136s    31.040:    30.573s    41.600:   3m4.847s    50.440:    10.218s    57.640:     8.434s    66.550:     5.915s    78.400:  3m10.534s
    4.240:    59.983s    14.800:  3m15.781s    24.040:    31.649s    31.200:  3m12.048s    41.640:    18.129s    50.550:     8.161s    57.750:     8.259s    66.600:  3m16.757s    78.600:  3m11.578s
    4.400:  21m7.900s    14.840:    47.923s    24.150:    31.813s    31.240:    29.674s    41.800:   3m3.403s    50.600:  3m17.306s    57.800:  2m52.669s    66.640:     6.924s    78.800:   3m2.549s
    4.440:    58.029s    15.000:  3m13.725s    24.200:  2m58.152s    31.400:   3m6.713s    41.840:    17.849s    50.640:     8.130s    57.840:     8.198s    66.750:     7.455s    79.000:  2m59.880s
    4.600: 17m36.935s    15.040:    48.752s    24.240:    31.277s    31.440:    29.026s    42.000:   3m2.460s    50.750:     7.104s    57.950:     8.234s    66.800:  3m14.313s    79.200:  2m54.728s
    4.640:    59.490s    15.200:  3m13.834s    24.350:    31.373s    31.600:   3m4.250s    42.040:    18.268s    50.800:  3m17.683s    58.000:  2m59.752s    66.840:     6.415s    79.400:  2m56.397s
    4.800: 17m56.895s    15.240:    47.315s    24.400:   3m1.471s    31.640:    29.563s    42.200:  3m11.070s    50.840:     7.358s    58.040:     8.425s    66.950:     8.394s    79.600:  2m56.190s
    4.840:    58.097s    15.400:  3m11.625s    24.440:    30.743s    31.800:   3m3.405s    42.240:    17.810s    50.950:     7.227s    58.200:   3m3.428s    67.000:   3m9.709s    79.800:   3m0.323s
    5.000: 24m21.299s    15.440:    48.359s    24.550:    30.031s    31.840:    28.936s    42.400:  3m13.731s    51.000:  3m12.524s    58.240:     8.157s    67.040:     7.770s    80.000:  2m59.837s
    5.040:    58.776s    15.600:   3m1.782s    24.600:   3m7.315s    32.000:   3m0.497s    42.440:    17.434s    51.040:     7.658s    58.400:   3m8.922s    67.150:     9.355s    80.200:   3m6.917s
    5.200:  8m54.283s    15.640:    46.641s    24.640:    30.634s    32.040:    28.952s    42.600:  3m18.076s    51.150:     7.487s    58.440:     8.162s    67.200:   3m1.015s    80.400:   3m9.189s
    5.240:    56.914s    15.800:   3m0.194s    24.750:    29.767s    32.200:   3m9.301s    42.640:    17.413s    51.200:   3m7.496s    58.600:  3m18.333s    67.240:     8.396s    80.600:   3m7.340s
    5.400:  8m11.126s    15.840:    47.750s    24.800:   3m9.417s    32.240:    28.201s    42.800:  3m18.129s    51.240:     7.434s    58.640:     8.168s    67.350:    11.866s    80.800:   3m3.145s
    5.440:    58.566s    16.000:   3m0.861s    24.840:    28.832s    32.400:  3m13.370s    42.840:    18.428s    51.350:     7.493s    58.800:   3m7.094s    67.400:   3m0.713s    81.000:   3m0.229s
    5.600:   6m8.218s    16.040:    46.160s    24.950:    29.704s    32.440:    28.416s    43.000:  3m15.761s    51.400:   3m0.507s    58.840:     8.199s    67.440:     9.777s    81.200:  2m51.655s
    5.640:    57.297s    16.200:   3m0.836s    25.000:   3m2.510s    32.600:  3m13.843s    43.040:    17.900s    51.440:    10.897s    59.000:   3m7.433s    67.550:    11.579s    81.400:  2m54.380s
    5.800:   6m1.374s    16.240:    47.323s    25.040:    28.587s    32.640:    28.758s    43.200:  3m10.730s    51.600:   3m2.763s    59.040:     8.313s    67.600:   3m1.592s    81.600:  2m54.897s
    5.840:    57.914s    16.400:   3m6.411s    25.150:    29.230s    32.800:  3m17.089s    43.240:    17.275s    51.640:    10.111s    59.200:   3m1.814s    67.640:    11.689s    81.800:   3m0.201s
    6.000:  5m47.339s    16.440:    46.309s    25.200:   3m1.638s    32.840:    28.700s    43.400:   3m3.444s    51.800:   3m2.292s    59.240:     8.271s    67.750:    11.390s    82.000:   3m3.283s
    6.040:    56.780s    16.600:  3m11.529s    25.240:    28.085s    33.000:   3m8.766s    43.440:    17.469s    51.840:     8.984s    59.400:  2m52.791s    67.800:  2m56.189s    82.200:   3m9.157s
    6.200:  5m39.433s    16.640:    47.301s    25.350:    29.155s    33.040:    27.797s    43.600:   3m5.931s    52.000:   3m9.066s    59.440:     8.234s    67.840:    10.923s    82.400:  3m15.298s
    6.240:    57.838s    16.800:  3m15.051s    25.400:  2m57.242s    33.200:   3m3.554s    43.640:    16.967s    52.040:     6.349s    59.600:  2m57.524s    67.950:    10.770s    82.600:   3m7.781s
    6.400:  5m43.985s    16.840:    45.463s    25.440:    28.169s    33.240:    29.378s    43.800:   3m3.264s    52.150:     6.174s    59.640:     8.233s    68.000:   3m2.641s    82.800:   3m6.069s
    6.440:    55.526s    17.000:  3m13.271s    25.550:    33.676s    33.400:   3m3.431s    43.840:    17.154s    52.200:  3m14.372s    59.800:  2m53.800s    68.040:    10.299s    83.000:   3m1.089s
    6.600:  5m46.909s    17.040:    46.908s    25.600:  2m45.022s    33.440:    28.339s    44.000:   3m3.830s    52.240:     6.460s    59.840:     8.225s    68.150:    11.184s    83.200:  2m48.626s
    6.640:    57.649s    17.200:  3m12.226s    25.640:    32.383s    33.600:  2m58.790s    44.040:    16.592s    52.350:     6.184s    60.000:  2m59.504s    68.200:   3m7.471s    83.400:  2m55.820s
    6.800:  5m46.270s    17.240:    45.229s    25.750:    35.749s    33.640:    28.411s    44.200:  3m11.251s    52.400:  3m20.819s    60.040:     8.085s    68.240:    10.759s    83.600:  2m54.642s
    6.840:    56.310s    17.400:   3m7.224s    25.800:  2m46.617s    33.800:  2m56.410s    44.240:    16.862s    52.440:     6.015s    60.200:   3m5.067s    68.350:    11.868s    83.800:  2m57.216s
    7.000:  5m42.391s    17.440:    46.192s    25.840:    34.496s    33.840:    28.187s    44.400:  3m16.127s    52.550:     6.133s    60.240:     8.656s    68.400:  3m11.781s    84.000:   3m3.073s
    7.040:    56.835s    17.600:   3m0.621s    25.950:    35.153s    34.000:  2m55.893s    44.440:    16.782s    52.600:  3m23.211s    60.400:  3m14.106s    68.440:    11.690s    84.200:  3m10.117s
    7.200:  5m37.280s    17.640:    43.463s    26.000:  2m48.298s    34.040:    28.489s    44.600:  3m15.211s    52.640:     5.853s    60.440:     8.385s    68.550:    10.405s    84.400:  3m16.946s
    7.240:    54.130s    17.800:   3m0.784s    26.040:    34.574s    34.200:   3m4.489s    44.640:    16.428s    52.750:     6.244s    60.550:     9.104s    68.600:  3m11.991s    84.600:   3m5.711s
    7.400:  5m22.413s    17.840:    43.687s    26.150:    34.463s    34.240:    27.320s    44.800:  3m11.483s    52.800:  3m14.764s    60.600:  3m13.434s    68.640:    10.131s    84.800:  3m18.763s
    7.440:    54.890s    18.000:  2m59.497s    26.200:  2m57.052s    34.400:   3m7.024s    44.840:    16.667s    52.840:     6.809s    60.640:     9.417s    68.800:   3m7.346s    85.000:  3m14.691s
    7.600:  5m20.108s    18.040:    42.464s    26.240:    33.541s    34.440:    27.998s    45.000:  3m12.824s    52.950:     6.092s    60.750:     9.033s    68.840:     9.935s    85.200:   3m3.477s
    7.640:    55.258s    18.200:  2m59.199s    26.350:    35.225s    34.600:   3m9.723s    45.040:    16.210s    53.000:  3m15.793s    60.800:   3m6.930s    69.000:   3m5.117s    85.400:   3m8.898s
    7.800:  3m20.921s    18.240:    43.350s    26.400:   3m5.603s    34.640:    27.051s    45.200:   3m3.392s    53.040:     7.427s    60.840:    10.186s    69.040:     9.495s    85.600:   3m6.991s
    7.840:    56.434s    18.400:   3m9.396s    26.440:    33.937s    34.800:  3m16.247s    45.240:    15.795s    53.150:     6.580s    60.950:     9.751s    69.200:  2m57.310s    85.800:  3m15.126s
    8.000:  3m12.517s    18.440:    40.991s    26.550:    34.213s    34.840:    27.170s    45.400:   3m0.213s    53.200:   3m6.516s    61.000:   3m2.210s    69.240:     9.893s    86.000:  3m18.570s
    8.040:    54.982s    18.600:  3m12.083s    26.600:  3m13.198s    35.000:  3m13.271s    45.440:    15.815s    53.240:     7.710s    61.040:    10.502s    69.400:  2m57.485s    86.200:  3m23.337s
    8.200:  3m13.981s    18.640:    43.045s    26.640:    33.551s    35.040:    28.283s    45.600:   3m0.694s    53.350:     6.913s    61.150:     9.986s    69.440:     9.865s    86.400:  3m27.126s
    8.240:    55.837s    18.800:  3m15.171s    26.750:    34.131s    35.200:   3m7.104s    45.640:    15.958s    53.400:   3m0.877s    61.200:  2m59.246s    69.600:  2m57.822s    86.600:  3m17.609s
    8.400:  3m21.037s    18.840:    41.396s    26.800:  3m19.387s    35.240:    26.938s    45.800:   3m0.660s    53.440:     7.874s    61.240:    10.935s    69.640:     9.010s    86.800:  3m17.213s
    8.440:    54.240s    19.000:  3m13.975s    26.840:    33.512s    35.400:   3m5.545s    45.840:    15.187s    53.550:     8.662s    61.350:     9.721s    69.800:  2m58.280s    87.000:   3m9.444s
    8.600:  3m30.165s    19.040:    43.167s    26.950:    34.101s    35.440:    25.622s    46.000:  2m57.955s    53.600:   3m1.254s    61.400:  2m57.320s    69.840:     9.635s    87.200:   3m2.674s
    8.640:    54.916s    19.200:  3m15.247s    27.000:  3m15.835s    35.600:   3m2.899s    46.040:    15.434s    53.640:     8.516s    61.440:    10.400s    70.000:   3m6.548s    87.400:   3m3.387s
    8.800:  3m27.499s    19.240:    40.403s    27.040:    33.250s    35.640:    25.081s    46.200:   3m8.407s    53.750:     8.773s    61.550:     9.961s    70.040:     7.527s    87.600:  2m58.242s
    8.840:    54.253s    19.400:  3m11.277s    27.150:    34.076s    35.800:   3m1.062s    46.240:    15.653s    53.800:   3m1.745s    61.600:  2m56.178s    70.200:  3m10.319s    87.800:   3m6.799s
    9.000:  3m28.547s    19.440:    42.571s    27.200:  3m13.345s    35.840:    25.321s    46.400:  3m13.026s    53.840:     9.122s    61.640:    10.388s    70.240:     7.217s    88.000:   3m1.808s
    9.040:    54.275s    19.600:   3m9.510s    27.240:    32.552s    36.000:  2m59.546s    46.440:    15.527s    53.950:     8.464s    61.750:     9.875s    70.400:  3m13.451s    88.200:  2m55.993s
    9.200:  3m22.017s    19.640:    40.060s    27.350:    31.481s    36.040:    25.405s    46.600:  3m20.489s    54.000:   3m4.280s    61.800:  2m53.438s    70.440:     5.507s    88.400:  2m40.639s
    9.240:    53.329s    19.800:  3m11.231s    27.400:  3m12.603s    36.200:   3m7.348s    46.640:    14.871s    54.040:     9.156s    61.840:    10.542s    70.600:  3m17.584s    88.600:  2m29.794s
    9.400:  3m14.750s    19.840:    40.639s    27.440:    30.853s    36.240:    24.418s    46.800:  3m18.543s    54.150:     8.123s    61.950:    10.381s    70.640:     3.250s    88.800:  5m50.370s
    9.440:    54.275s    20.000:  2m54.576s    27.550:    30.973s    36.400:   3m8.386s    46.840:    14.883s    54.200:   3m5.101s    62.000:   3m2.384s    70.800:  3m16.944s    89.000:  6m13.211s
    9.600:   3m4.015s    20.040:    38.954s    27.600:   3m2.082s    36.440:    24.321s    47.000:  3m16.099s    54.240:     9.721s    62.040:    10.572s    70.920:     3.744s    89.200:  4m26.945s
    9.640:    53.087s    20.200:  2m54.912s    27.640:    31.078s    36.600:  3m10.166s    47.040:    14.806s    54.350:     8.138s    62.150:    10.044s    71.000:  3m14.807s    89.400:  4m24.070s
    9.800:   3m6.119s    20.240:    40.981s    27.750:    31.524s    36.640:    24.146s    47.200:   3m9.301s    54.400:  3m12.914s    62.200:   3m4.502s    71.200:   3m3.817s    89.600:  3m49.165s
    9.840:    54.255s    20.400:   3m1.946s    27.800:   3m5.364s    36.800:  3m12.015s    47.240:    12.182s    54.440:     9.453s    62.240:    10.719s    71.240:     3.702s    89.800:  3m22.028s
   10.000:   3m8.055s    20.440:    37.871s    27.840:    30.877s    36.840:    24.429s    47.350:    12.623s    54.550:     8.257s    62.350:     9.780s    71.400:   3m7.041s    90.000:   1m8.532s
   10.040:    52.085s    20.600:   3m2.719s    27.950:    32.520s    37.000:   3m9.313s    47.400:   3m7.559s    54.600:  3m17.790s    62.400:   3m9.149s    71.520:     3.253s
   10.200:   3m5.559s    20.640:    40.726s    28.000:  2m59.996s    37.040:    23.418s    47.440:    12.982s    54.640:     8.632s    62.440:    11.012s    71.600:   3m1.903s
   10.240:    53.507s    20.800:   3m5.259s    28.040:    32.152s    37.200:   3m5.607s    47.550:    12.194s    54.750:     8.051s    62.550:     8.831s    71.800:   3m1.373s
   10.400:  3m11.179s    20.840:    38.004s    28.150:    31.697s    37.240:    24.078s    47.600:   3m8.997s    54.800:   3m9.094s    62.600:  3m12.898s    72.000:   3m8.410s
   10.440:    52.541s    21.000:   3m2.880s    28.200:   3m9.292s    37.400:  2m59.183s    47.640:    12.780s    54.840:     9.471s    62.640:    10.066s    72.080:     3.605s

The estimate command says that the print should take 1d8h23m41.648s however it actually only took 21h 30m 55s to complete (superslicer predicted 19h 28m 55s).

Apologies if I'm doing something stupid. Is there any setup or configuration I'm missing or is this not working properly for some other reason?

Thanks!

M1 version

Despite the fact that the x86_64 version works great on M1 Macs, is it on the horizon of providing an ARM64 version for OS X?

RFE: Support hostname DNS resolution

Currently, specifying the moonraker url as a hostname does not seem to work, but specifying the IP address does.

$ ./klipper_estimator_linux --config_moonraker_url http://neptune.local estimate ~/N2_3DBenchy.gcode
Failed to load printer configuration: request failed: error sending request for url (http://neptune.local/printer/objects/query?configfile=settings): error trying to connect: dns error: failed to lookup address information: Name does not resolve

However, going to that address in the browser does bring up the settings. Specifying the IP address works:

./klipper_estimator_linux --config_moonraker_url http://192.168.1.195 estimate ~/N2_3DBenchy.gcode
Sequences:
 Run 0:
  Total moves:                 103699
  Total distance:              148578.751mm
  Total extrude distance:      3827.612mm
  Minimal time:                41m35.739s (2495.739s)
  ...

It would be a really nice usability feature to support hostname resolution and not necessitate a static IP

Trailing / in moonraker url on command line fails to work

Compare the two

C:\Users\accou\OneDrive\Reprap\klipper_estimator>"C:\Users\accou\OneDrive\Reprap\klipper_estimator\klipper_estimator.exe" --config_moonraker_url http://voronpi.lan/ post-process "c:\Users\accou\OneDrive\Desktop\20mm-box-Doc 2.4-Voron eSun Abs+ Purple.gcode"
Failed to load printer configuration: reqwest::Error { kind: Decode, source: Error("missing field `result`", line: 1, column: 390) }

C:\Users\accou\OneDrive\Reprap\klipper_estimator>"C:\Users\accou\OneDrive\Reprap\klipper_estimator\klipper_estimator.exe" --config_moonraker_url http://voronpi.lan post-process "c:\Users\accou\OneDrive\Desktop\20mm-box-Doc 2.4-Voron eSun Abs+ Purple.gcode"

C:\Users\accou\OneDrive\Reprap\klipper_estimator>

Also typo of reqwest should be request

Support floats for M73 P

M73 commands seem to be overwritten by the script but they are always integers. When the print is long, each 1% represents a large chunk of time. klipper supports float values for the M73 P parameter which would give a more granular estimate update for long running prints.

I think here you just want to get rid of that call to round() or round it to say 3 decimal places.

Can't handle prints with Cura's `cool_lift_head`

If Cura's cool_lift_head (lift head when minimum layer time can't be met within minimum speed constraint) feature is enabled, the estimator treats each layer as a distinct print (due to Z motion back down after the lift). I'm not sure if the same happens with normal Z hop, but there probably should be some way to get the estimator to treat the pattern "increase in Z, no extrusion, return to original Z" as a hop (and account for time of hops) rather than as starting a new print.

Failed to run klipper_estimator

Hello
i get an error when i want to slice the file and transfer it to klipper.

Fallen to run klipper_estimator
b'thread main panicked at 'gcode read: IO(Error {kind: InvalidData, message: "stream did not contain valid UTF-8" }, tool/ src/cmd/post_process.rs:355:27\nnote: run with 'RUST_BACKTRACE=1 environment variable to display a backtrace\n'

I use
klipper-preprocessor and I also entered where the klipper_estimator is located

Issue with Release Version of Estimator Hanging when Piped in Command Line

Hey there,

I've encountered an issue with the release version of the estimator. When I run the following command in the command line with a pipe, the release version gets stuck and doesn't exit:

C:\Users\admin\Downloads>klipper_estimator.exe estimate 3DBenchy_prusaslicer.gcode | findstr inim
Minimal time: 0.824s (0.824s)
Minimal time: 5h44m27.943s (20667.943s)

Interestingly, I don't experience this problem when I run the build with debug symbols.

build failure on debian buster

Tried to build&install on amd64/debian buster machine.
Installed the required packages:

The following additional packages will be installed:
  gdb libbabeltrace1 libc6-dbg libhttp-parser2.8 libipt2 libstd-rust-1.41 libstd-rust-dev rust-gdb rustc
Suggested packages:
  cargo-doc gdb-doc gdbserver rust-doc rust-src lld-7
The following NEW packages will be installed:
  cargo gdb libbabeltrace1 libc6-dbg libhttp-parser2.8 libipt2 libstd-rust-1.41 libstd-rust-dev rust-gdb rustc
0 upgraded, 10 newly installed, 0 to remove and 3 not upgraded.
Need to get 59,3 MB of archives.
After this operation, 199 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian buster-updates/main amd64 libhttp-parser2.8 amd64 2.8.1-1+deb10u2 [20,2 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 libstd-rust-1.41 amd64 1.41.1+dfsg1-1~deb10u1 [14,2 MB]
Get:3 http://deb.debian.org/debian buster/main amd64 libstd-rust-dev amd64 1.41.1+dfsg1-1~deb10u1 [25,2 MB]
Get:4 http://deb.debian.org/debian buster/main amd64 rustc amd64 1.41.1+dfsg1-1~deb10u1 [1.863 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 cargo amd64 0.43.1-3~deb10u1 [3.085 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 libbabeltrace1 amd64 1.5.6-2+deb10u1 [172 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 libipt2 amd64 2.0-2 [41,7 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 gdb amd64 8.2.1-2+b3 [3.133 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 libc6-dbg amd64 2.28-10 [11,5 MB]
Get:10 http://deb.debian.org/debian buster/main amd64 rust-gdb all 1.41.1+dfsg1-1~deb10u1 [150 kB]

Building klipper_estimator fails:

debian@Klipper:~/klipper_estimator$ cargo build --release
error: failed to parse manifest at `/home/debian/klipper_estimator/tool/Cargo.toml`

Caused by:
  failed to parse the `edition` key

Caused by:
  supported edition values are `2015` or `2018`, but `2021` is unknown

Won't open on windows 11

As soon as i click on the exe, a cmd pops up, but as soon as animation is done, it disappears as fast as it came and nothing else.

FR: Arc Support

When running klipper_estimator on an arc-welded file it provides wildly incorrect estimates. Ideally, the gcode file could be processed through klipper_estimator after its been arc-welded.

Estimated time shorter

On my Klipper based modded Voron 2.4 I've had very low feedrate limits configured in SuperSlicer by accident as I did not recognize that they need to be entered in mm/min and thought it would be mm/s when I switch from Simplify3D to SuperSlicer.

Anyways - I would have expected klipper_estimator to calculate the time closely to the actual print time even with those weird settings.

In your program description you write:

If the timing is far off(e.g. more than a minute over a >12 hour print), this is considered a bug.

In my case the the actual print time was much longer than the forecast of kliper_estimator and so I wonder if there could be a logical problem if limits are set via GCODE?

This is my test gcode SuperSlicer v2.3.57 produces:
DinRailMount6.5mm-6.35279g-27m.gcode.zip

SuperSlicer v2.3.57 expects a print time of: 26m 59s
Klipper_estimator v1.5.0 calculates a print time of 28m 51s
Real print time took: 38m 49s

The picture of KlipperScreen shows the expected print time patched by klipper_estimator and the actually needed time to print:
20220128_191330

My json dump-config looks like this:

{
  "max_velocity": 500.0,
  "max_acceleration": 10000.0,
  "max_accel_to_decel": 10000.0,
  "square_corner_velocity": 5.0,
  "instant_corner_velocity": 1.0,
  "move_checkers": [
    {
      "axis_limiter": {
        "axis": [
          0.0,
          0.0,
          1.0
        ],
        "max_velocity": 30.0,
        "max_accel": 1000.0
      }
    },
    {
      "extruder_limiter": {
        "max_velocity": 60.0,
        "max_accel": 600.0
      }
    }
  ]
}

In SuperSlicers printer settings tab I've had the following very weird limits configured:

  • Maximum feedrate X: 500mm/min
  • Maximum feedrate Y: 500mm/min
  • Maximum feedrate X: 30mm/min
  • Maximum feedrate E: 60mm/min
  • Maximum acceleration X: 9000mm/s^2
  • Maximum acceleration Y: 9000mm/s^2
  • Maximum acceleration Z: 500mm/s^2
  • Maximum acceleration E: 10000mm/s^2
  • Maximum acceleration when extruding: 5000mm/s^2
  • Maximum acceleration when retracting: 5000mm/s^2
  • Maximum acceleration when traveling: 5000mm/s^2
  • Maximum jerk X: 10mm/s
  • Maximum jerk Y: 10mm/s
  • Maximum jerk Z: 2.5mm/s
  • Maximum jerk E: 2.5mm/s
  • Minimum feedrate when extruding: 0mm/min
  • Minimum travel feedrate: 0mm/min

In general is klipper_estimator able to calculate the influences of activated pressure advance and input shaper?

Before getting informed about your tool I've run these 2 commands on the Raspberry PI after gcode file upload:

sed -e '/\[include inputshaper.cfg\]/d' ~/klipper_config/printer.cfg > ~/klipper_config/printer.cfg.tmp
~/klippy-env/bin/python ~/klipper/klippy/klippy.py ~/klipper_config/printer.cfg.tmp -d ~/klipper/out/klipper.dict -o /dev/null -i ~/gcode_files/my_uploaded.gcode

and used the calculated time to automatically patch the gcode.

Like you see I had to disable the input shaper config section as the klippy dry-run failed when finding [mcu rpi] and [adxl345] sections in the printer.cfg file. The missing input shaper config resulted in a falsified but a little better estimation of 31m 8s for the upper example.

Thank you for the great work you put into addressing the klipper print time estimation problem!

unclear docs

for ESTIMATOR_ADD_TIME <duration> is duration minutes, seconds, msec, earth revolutions around the sun?

Installation

Can someone guide me in the process of installisng this and get it configured ? Using Orca Slicer.
I found it unclear. I've tried and need some step by step help, please.
May help others too, from what I read online, who struggle to implement this.

My setup is:
. Ender 3 S1
. Raspberry Pi 4 running klipper (KIAUH)

Thanks.

FR: Rename function

Most slicers offer the option to put the print time as a part of the filename. Would it be possible to update that time/attach the actual print time (rounded to hours and minutes) in the filename?
i.e. I get the filename: "Testobject_ASA_1h43m.gcode", but klipper_estimator calculates an actual 2:28 print time. If the name could be changed to "Testobject_ASA_2h28m.gcode" before uploading to Klipper, that'd make it much easier to see at a glance what jobs to print next.

Windows exe doesnt start

The exe doesn't start.
Have copy it with the config.json in the Orca Slicer Folder and edit the Script. But Orca gives me an error, if i want to export the gcode.
See the two attechments.

Thanks.

grafik
grafik

I have compile it by myself on windows, but also doesnt work.,.

EDIT: It seems, that i can run estimate from Powershell, but not the post processing Script from the OrcaSlicer -.-
.\ before klipper_estimator.exe in PowerShell means trust the file. Dont know if i can change it in Windows or in Orca.

PS C:\Program Files\OrcaSlicer> .\klipper_estimator.exe --config_moonraker_url http://'..***.210 estimate C:\Users\Crocop\Downloads\ELFA_Stand_v2_PETG_1h9m.gcode
Sequences:
Run 0:
Total moves: 131610
Total distance: 176855.451mm
Total extrude distance: 5650.123mm
Minimal time: 47m16.929s (2836.929s)
Total print move time: 37m2.526s (2222.526s)
Total extrude-only time: 1m35.391s (95.391s)
Total travel time: 8m38.762s (518.762s)
Average speed: 62.340 mm/s
Top speed: 200.000 mm/s
Average flow: 4.790 mm³/s
Maximum flow: 10.697 mm³/s
Average flow (output only): 6.115 mm³/s
Phases:
Acceleration: 10m39.924s
Cruise: 25m56.840s
Deceleration: 10m39.915s
Move kind distribution:
12m59.440s Outer wall
12m16.817s Sparse infill
6m29.494s Gap infill
5m51.408s Internal solid infill
3m4.832s Inner wall
2m3.441s Top surface
2m1.586s Bottom surface
1m53.606s Internal Bridge
9.774s Present print
8.654s Skirt
6.802s Retract and raise Z
4.975s Wipe out
2.293s Overhang wall
1.993s Raise Z more
1.463s Custom
0.100s Retract a bit
Layer time distribution:
0.000: 0.063s 7.000: 22.665s 14.000: 10.940s 21.000: 5.991s 28.000: 5.970s
0.200: 2m23.539s 7.200: 22.892s 14.200: 10.832s 21.200: 6.101s 28.200: 5.992s
0.400: 1m1.299s 7.400: 23.677s 14.400: 10.825s 21.400: 5.968s 28.400: 6.101s
0.600: 1m0.909s 7.600: 25.494s 14.600: 11.152s 21.600: 5.991s 28.600: 5.972s
0.800: 1m0.724s 7.800: 26.442s 14.800: 10.773s 21.800: 6.101s 28.800: 5.993s
1.000: 38.579s 8.000: 25.714s 15.000: 10.697s 22.000: 5.969s 29.000: 6.101s
1.200: 37.254s 8.200: 24.180s 15.200: 10.571s 22.200: 5.991s 29.200: 5.973s
1.400: 48.009s 8.400: 22.735s 15.400: 10.667s 22.400: 6.101s 29.400: 5.995s
1.600: 20.863s 8.600: 21.711s 15.600: 11.589s 22.600: 5.969s 29.600: 6.101s
1.800: 22.006s 8.800: 21.789s 15.800: 11.575s 22.800: 5.990s 29.800: 5.974s
2.000: 22.038s 9.000: 22.065s 16.000: 11.899s 23.000: 6.101s 30.000: 5.997s
2.200: 23.872s 9.200: 26.152s 16.200: 11.167s 23.200: 5.969s 30.200: 6.100s
2.400: 25.098s 9.400: 1m57.132s 16.400: 10.555s 23.400: 5.990s 30.400: 5.973s
2.600: 26.321s 9.600: 57.636s 16.600: 10.899s 23.600: 6.101s 30.600: 5.990s
2.800: 26.023s 9.800: 57.579s 16.800: 10.017s 23.800: 5.968s 30.800: 6.100s
3.000: 24.568s 10.000: 1m45.778s 17.000: 10.530s 24.000: 5.991s 31.000: 5.969s
3.200: 22.760s 10.200: 8.912s 17.200: 10.806s 24.200: 6.101s 31.200: 5.990s
3.400: 22.335s 10.400: 11.960s 17.400: 10.479s 24.400: 5.968s 31.400: 6.100s
3.600: 22.581s 10.600: 13.103s 17.600: 8.765s 24.600: 5.991s 31.600: 5.969s
3.800: 23.329s 10.800: 10.664s 17.800: 8.621s 24.800: 6.100s 31.800: 5.990s
4.000: 24.634s 11.000: 11.816s 18.000: 8.588s 25.000: 5.969s 32.000: 6.100s
4.200: 26.092s 11.200: 11.338s 18.200: 8.338s 25.200: 5.991s 32.200: 5.969s
4.400: 26.177s 11.400: 11.221s 18.400: 8.028s 25.400: 6.101s 32.400: 5.989s
4.600: 24.967s 11.600: 11.096s 18.600: 7.974s 25.600: 5.969s 32.600: 6.100s
4.800: 24.139s 11.800: 10.714s 18.800: 7.861s 25.800: 5.990s 32.800: 5.969s
5.000: 22.330s 12.000: 12.505s 19.000: 7.485s 26.000: 6.101s 33.000: 5.990s
5.200: 21.968s 12.200: 10.547s 19.200: 7.299s 26.200: 5.969s 33.200: 6.101s
5.400: 22.005s 12.400: 10.277s 19.400: 7.381s 26.400: 5.990s 33.400: 5.969s
5.600: 22.809s 12.600: 10.239s 19.600: 6.994s 26.600: 6.101s 33.600: 5.991s
5.800: 24.545s 12.800: 10.489s 19.800: 6.844s 26.800: 5.968s 33.800: 6.100s
6.000: 25.721s 13.000: 10.846s 20.000: 6.879s 27.000: 5.991s 34.000: 6.069s
6.200: 26.615s 13.200: 11.342s 20.200: 6.513s 27.200: 6.101s 34.200: 1.429s
6.400: 25.299s 13.400: 11.426s 20.400: 6.334s 27.400: 5.969s 34.400: 1.141s
6.600: 23.372s 13.600: 11.366s 20.600: 6.101s 27.600: 5.991s
6.800: 22.950s 13.800: 10.465s 20.800: 5.968s 27.800: 6.101s
PS C:\Program Files\OrcaSlicer>

FEATURE: support bonjour .local names

Hi
Excelent tool. As suggestion, would be nice if it support .local name resolution:

eris@eris:~/Lixo/3D$ ./klipper_estimator_linux --config_moonraker_url http://mainsail.local dump-config > config.json
Failed to load printer configuration: request failed: error sending request for url (http://mainsail.local/printer/objects/query?configfile=settings): error trying to connect: dns error: failed to lookup address information: Try again

Dont work...

./klipper_estimator_linux --config_moonraker_url http://192.168.0.11 dump-config > config.json

Works

Error on post-process (estimate working fine)

Whenever I run klipper_estimator in post-process mode, I get the following error:

>>> .\klipper_estimator.exe --config_moonraker_url http://ratos.local post-process SmallCube.gcode
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', tool/src/cmd/post_process.rs:289:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I've tried a number of different g-code files, both with v1.0.0 and v1.1.0, and I've tried both on Windows (klipper_estimator.exe) and on my RPI (klipper_estimator_rpi). Running estimate returns the expected result (see below).

  • Slicer: SuperSlicer 2.3.57
  • OS: Windows 10 / RatOS (a MainsailOS flavor)
  • Klipper: v0.10.0-225-g6e6ad7b5
  • Moonraker: v0.7.1-285-g505c1bf

Sample of a gcode file that failed for me.
Result of this file using estimate:

Sequences:
 Run 0:
  Total moves: 905
  Total distance: 2180.537mm
  Total extrude distance: 51.309mm
  Minimal time: 1m4.534s (64.534s)
  Average flow: 1.912368528150471 mm³/s
  Phases:
   Acceleration: 6.882s
   Cruise:       50.966s
   Deceleration: 6.686s
  Move kind distribution:
   43.971s              => Internal perimeter
   17.541s              => External perimeter
   1.068s               => Custom
   0.993s               => Firmware retract
   0.962s               => Firmware unretract
  Layer time distribution:
thread 'main' panicked at 'index out of bounds: the len is 16 but the index is 16', tool/src/cmd/estimate.rs:257:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   0.000: 0.031s    0.320: 1.955s    0.640: 1.956s    0.960: 1.956s    1.280: 1.956s    1.600: 1.956s    1.920: 1.956s    2.240: 1.956s    2.560: 1.956s    2.880: 1.956s    3.200: 1.956s    3.520: 1.956s    3.840: 1.956s    4.160: 1.956s    4.480: 1.956s    4.800: 1.956s

Cura Support

Your documentation says it works in Cura for post-processing, but I cannot find ANY documentation anywhere on how to properly write a py script so that it calls the command you mention. Any ideas? In SuperSlicer as you documented, this is very easy. Cura, not so much. Would you mind updating the README with an example for Cura as well?

Thanks!

Time estimate off by 25%

I've got a model that I am slicing in SuperSlicer. When I send the gocde to the printer, the slicer says it will take 10 hours and 55 minutes, however the print completed in 7:09. I assumed that something was wrong and suspected that it was not reading the config data from moonraker, so I ran the estimator from the command line (ubuntu 21:10), and it gave exactly the same result (ie 10:55) but no errors were thrown, so I assume that means that there were no problems getting the config data from moonraker.

I'm assuming that I have done something wrong rather than this being a bug, but I'm not sure what else I can check, so I would appreciate any tips.

EDIT: Stupidly, I resliced the file with updated settings and overwrote the original, I will upload the .3mf and .gcode files later, along with updated times

Cheers, John

Wrong version when compiling

You know me, I like to dick around with new stuff. So I was compiling this myself and I noticed the versions in the output never get updated.

Example:
image

This still displays lib_klipper and klipper_estimator at v0.1.0, while you're still at v1.4.0

Use config.js if moonraker is not online

Hello,
it would be amazing, if the klipper estimator could use the config.js in the case the 3D Printer cannot be found in the network.
Should not be difficult to integrate.
Greetings

Klipper estimator.exe no launch.

On Windows 10 Klipper_Estimator.EXE doesn't appear to open, showing a cmd terminal for 1 Frame and then nothing.
Doesn't seem to effect time of print at all. EG a 1:44min print in cura takes 55min in Klipper.
It does not seem to make any config folder eather.

Klipper Estimator does not handle running out of memory well on a RasPi 4 , 4 GB

Tried this out on my RasPi 4, 4 GB (neat program by the way!) and my PC. While certain files work fine on both, for larger files, only my Windows PC is able to handle them. For files somewhere between 20-80 MB of gcode, I start getting failure messages like the following during execution of estimate:

Sequences:
memory allocation of 805306368 bytes failed
Aborted

Strangely, my memory utilization doesn't get anywhere near my full 4 GB before this happens.. i'm not quite sure why.. perhaps this is a malloc() failing in anticipation of needing more than 4 GB? It would be good to realize that on ARM platforms like the Ras Pi that memory is going to be limited, and some sort of caching-to-disk (yes, slower of course) as a slower fallback would be appropriate if the memory-hungry nature of the program can't otherwise be made more efficient.

Since Klipper itself of course is pretty memory efficient and happily runs without complaint with much less memory, I would hope there's ways to run Klipper_estimator in a more memory efficiency manner than is run today ?

Moonraker API doesn't support "Authorization"

When authorization is enabled on the moonraker server estimator just returns

Access is denied.

Please add a --api_key option to allow estimator to be used when moonraker authorization is enabled.

Estimated time longer

Hi Dalegaard,

I was using this script and noticed that on my print that SS estimated 9 1/2 hours it went down to 8h 26min.
estimator 1

After a print I rechecked the time it needed and this was 8hours 3min
estimator 2

I also saw you mentioned that it should be withing 1min on a +12 hour print or it would be considered a bug.

I've printed this on a Voron V2 (if you need more info to look into this, let me know)

regards.

FR: consider adding it to to metadata extract running at the moonraker file upload

I know it might be to early to do it know but it would be great if that could be integrated in the metadata extract running at every gcode file upload within moonraker.

I am fully aware that this means maybe a change of coding language.

There is a other project (execute objects) that already included a post process via a pip package so a other solution could be to integrate these 2 together

Works in W11?

Hi,

i have donwloaded... but i dont know how they make run in W11.

Exe file dont respond...

they have some prerrequisite?

[Feature request] Add support for object exclusions

Hi!

Just now I'm re-printing some older GCode with multiple objects, but I'm kinda short on time, so I had to exclude some of them.
I was thinking it would be great to run Klipper estimator on that GCode, specify objects to exclude and it would calculate the time without them.

Or a slightly different idea, don't specify objects to exclude, but estimate times for all objects and print them in the estimate command.

What do you think?

FR: Use config-file when printer is off

I use Moonraker power control to turn off my printer with a relay whenever I'm not printing but I leave the Raspberry Pi always on. That causes Klipper to go to emergency shutdown as it can't communicate with the MCUs and thus Moonraker API to fetch the config is not working.

What I'd like is to have the option to use both --config_moonraker_url and --config_file parameters and then the moonraker config would be used if it is available and the config file is a fallback if moonraker is not responding. Even better would be to have a new flag which would dump the config from moonraker to the config file if moonraker is available so the offline copy is kept up-to-date.

I already tried adding the dump-config command before the post-process command in my slicer so the config file would be updated but it failed as the slicer added gcode file as a parameter which prevented the dump-config from running. If this parameter would be ignored, then this would be viable option as well.

FR: scaled_xy_accel support for limited_cartesian

The axis limiter is for an out-of-tree Klipper feature, limited_cartesian kinematics with per-axis limits. However the good version of this feature has the capability to treat the per-axis acceleration limits as relative to the current M204 acceleration rather than global limits. It would be nice if klipper_estimator supported this convention too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.