Annex-Engineering / klipper_estimator

MIT License
283 stars 26 forks source link

Estimated print time off by a lot/seemingly random amounts #61

Closed stevereno30 closed 5 months ago

stevereno30 commented 6 months ago

For the past month, my klipper estimator has gone from being spot on to being terrible at estimating print times. In the following screenshot, the highlighted print job is when the issue started, but I have no idea what I changed between these two prints because there was a month between the two prints.

image

The top print in that screenshot is this gcode (zipped to keep below 25mb): Bolt.zip

Running klipper-estimator with that same gcode gives this output:

Sequences: Run 0: Total moves: 1367761 Total distance: 1878116.422mm Total extrude distance: 29409.755mm Minimal time: 17h43m33.579s (63813.579s) Total print move time: 13h4m58.469s (47098.469s) Total extrude-only time: 49m38.373s (2978.373s) Total travel time: 3h48m56.487s (13736.487s) Average speed: 29.431 mm/s Top speed: 98.308 mm/s Average flow: 1.109 mm³/s Maximum flow: 3.873 mm³/s Average flow (output only): 1.502 mm³/s Phases: Acceleration: 47m19.006s Cruise: 16h9m5.238s Deceleration: 47m9.085s Move kind distribution: 6h24m36.545s Solid infill 5h16m57.099s Internal infill 3h57m40.139s Perimeter 1h52m27.540s External perimeter 6m28.643s Bridge infill 4m55.691s Top solid infill 23.781s Skirt/Brim 2.155s Custom 1.736s Overhang perimeter

If needed, this is my printer config: printer.txt

stevereno30 commented 6 months ago

This issue has something to do with Klipper's Skew Correction feature. Commenting out my [skew_correction] section gives much more accurate estimates - off by a couple minutes instead of 10+ hours. Here is the estimate terminal output with skew_correction disabled:

Sequences: Run 0: Total moves: 1367761 Total distance: 1878116.422mm Total extrude distance: 29409.755mm Minimal time: 8h38m27.744s (31107.744s) Total print move time: 6h17m41.166s (22661.166s) Total extrude-only time: 49m38.373s (2978.373s) Total travel time: 1h31m7.954s (5467.954s) Average speed: 60.375 mm/s Top speed: 450.000 mm/s Average flow: 2.274 mm³/s Maximum flow: 8.411 mm³/s Average flow (output only): 3.122 mm³/s Phases: Acceleration: 2h3m54.293s Cruise: 4h30m58.029s Deceleration: 2h3m35.171s Move kind distribution: 2h40m3.977s Perimeter 2h32m48.821s Solid infill 2h6m53.987s Internal infill 1h13m25.544s External perimeter 2m58.185s Bridge infill 1m52.148s Top solid infill 22.649s Skirt/Brim 1.437s Overhang perimeter 0.745s Custom

stevereno30 commented 6 months ago

Skew wasn't the only issue. There is something else, as my prints continue to be off by hours in some cases. image

stevereno30 commented 6 months ago

Something about the post-process...um, process via PrusaSlicer is borked. The following gcodes were the same plate in PrusaSlicer exported twice. The 3.5 hour one was exported without doing anything special. The 1.5 hour one came about from the following procedure:

  1. The post-process script was removed from PrusaSlicer
  2. The file was exported without post processing to my desktop
  3. The file was processed via a terminal with the estimate command, resulting in a print time of 1h37min
  4. Post process script removal was reverted using PrusaSlicer's "undo" button
  5. File was sliced, and the resulting file has a print time of 1h37min

3h39m.gcode.txt 1h37m.gcode.txt

fjpanag commented 6 months ago

I have the same issue.

I do not use skew correction, but I do use Prusa Slicer v2.7.4, on Fedora 39.

The attached G-code is predicted in Prusa Slicer with a duration of 3:42.
Klipper estimator predicts 7:57!

The actual print time was 3:03.

image

wrong_estimation.gcode.txt

stevereno30 commented 5 months ago

Here is more evidence for this bug. I sliced a gcode, exported to my desktop without any post-processing, then ran klipper_estimator's estimate command via terminal two times in a row without changing anything. This is what my terminal output was:

PS C:\Users\steve> C:\Users\steve\Documents\KlipperProcesses\klipper_estimator.exe --config_moonraker_url http://192.168.0.10 estimate C:\Users\steve\Desktop\TEST.gcode Sequences: Run 0: Total moves: 992220 Total distance: 1469218.344mm Total extrude distance: 37280.289mm Minimal time: 18h27m15.998s (66435.998s) Total print move time: 13h18m8.225s (47888.225s) Total extrude-only time: 49m29.742s (2969.742s) Total travel time: 4h19m37.781s (15577.781s) Average speed: 22.115 mm/s Top speed: 82.578 mm/s Average flow: 1.350 mm³/s Maximum flow: 6.044 mm³/s Average flow (output only): 1.872 mm³/s Phases: Acceleration: 48m46.022s Cruise: 16h50m10.048s Deceleration: 48m19.677s Move kind distribution: 7h9m21.124s Perimeter 3h54m3.079s Solid infill 3h25m23.485s External perimeter 3h4m35.952s Internal infill 28m10.698s Bridge infill 23m48.365s Top solid infill 1m28.997s Overhang perimeter 22.214s Skirt/Brim 1.834s Custom Layer time distribution: 0.000: 0.049s 8.000: 14m30.979s 16.000: 3m6.773s 24.000: 13.248s 32.000: 15.263s 0.200: 25m18.298s 8.200: 11m40.325s 16.200: 3m27.954s 24.200: 14.691s 32.200: 12.944s 0.400: 22m21.810s 8.400: 11m41.782s 16.400: 3m26.003s 24.400: 16.372s 32.400: 11.801s 0.600: 24m35.248s 8.600: 11m42.087s 16.600: 3m25.318s 24.600: 16.002s 32.600: 12.108s 0.800: 25m1.912s 8.800: 11m40.714s 16.800: 3m23.952s 24.800: 15.923s 32.800: 12.013s 1.000: 23m40.045s 9.000: 11m35.998s 17.000: 3m15.901s 25.000: 16.731s 33.000: 11.657s 1.200: 15m12.620s 9.200: 11m14.980s 17.200: 1m17.564s 25.200: 12.960s 33.200: 11.625s 1.400: 15m52.684s 9.400: 11m40.590s 17.400: 50.693s 25.400: 14.280s 33.400: 12.102s 1.600: 15m21.708s 9.600: 11m30.437s 17.600: 49.300s 25.600: 14.644s 33.600: 12.226s 1.800: 14m59.991s 9.800: 11m14.806s 17.800: 47.403s 25.800: 14.649s 33.800: 12.479s 2.000: 14m43.862s 10.000: 10m54.057s 18.000: 47.077s 26.000: 14.658s 34.000: 12.092s 2.200: 15m0.602s 10.200: 10m53.562s 18.200: 48.128s 26.200: 14.662s 34.200: 11.892s 2.400: 16m22.838s 10.400: 10m12.418s 18.400: 46.735s 26.400: 14.669s 34.400: 11.959s 2.600: 16m39.977s 10.600: 10m24.621s 18.600: 46.132s 26.600: 14.711s 34.600: 11.698s 2.800: 16m15.863s 10.800: 10m23.749s 18.800: 46.429s 26.800: 14.694s 34.800: 11.698s 3.000: 16m21.927s 11.000: 10m8.750s 19.000: 42.039s 27.000: 14.696s 35.000: 11.744s 3.200: 18m27.667s 11.200: 8m42.638s 19.200: 40.674s 27.200: 14.704s 35.200: 13.741s 3.400: 19m29.126s 11.400: 8m21.421s 19.400: 39.757s 27.400: 14.739s 35.400: 14.310s 3.600: 19m1.436s 11.600: 8m2.932s 19.600: 36.542s 27.600: 15.555s 35.600: 14.029s 3.800: 18m54.573s 11.800: 7m53.088s 19.800: 35.454s 27.800: 16.487s 35.800: 15.615s 4.000: 19m2.510s 12.000: 7m58.817s 20.000: 32.593s 28.000: 16.506s 36.000: 17.552s 4.200: 16m59.638s 12.200: 6m3.942s 20.200: 24.650s 28.200: 19.510s 36.200: 14.722s 4.400: 16m27.838s 12.400: 5m46.412s 20.400: 21.524s 28.400: 17.182s 36.400: 15.079s 4.600: 15m58.091s 12.600: 5m44.195s 20.600: 21.276s 28.600: 17.303s 36.600: 15.082s 4.800: 16m3.644s 12.800: 5m45.990s 20.800: 21.375s 28.800: 17.442s 36.800: 14.281s 5.000: 15m45.590s 13.000: 5m44.491s 21.000: 21.560s 29.000: 16.270s 37.000: 15.031s 5.200: 15m36.268s 13.200: 5m41.520s 21.200: 23.635s 29.200: 14.987s 37.200: 15.117s 5.400: 15m31.678s 13.400: 5m32.090s 21.400: 24.137s 29.400: 14.788s 37.400: 14.993s 5.600: 15m31.232s 13.600: 5m32.478s 21.600: 24.211s 29.600: 14.914s 37.600: 14.653s 5.800: 15m6.131s 13.800: 5m35.243s 21.800: 24.956s 29.800: 14.977s 37.800: 14.517s 6.000: 14m41.879s 14.000: 5m42.057s 22.000: 25.188s 30.000: 14.861s 38.000: 14.483s 6.200: 15m40.457s 14.200: 6m24.277s 22.200: 23.968s 30.200: 14.196s 38.200: 14.500s 6.400: 16m31.777s 14.400: 6m8.706s 22.400: 23.573s 30.400: 14.219s 38.400: 14.505s 6.600: 15m53.601s 14.600: 6m10.465s 22.600: 23.525s 30.600: 13.947s 38.600: 15.743s 6.800: 15m35.413s 14.800: 6m13.968s 22.800: 23.438s 30.800: 14.393s 38.800: 16.064s 7.000: 15m58.501s 15.000: 6m16.146s 23.000: 24.012s 31.000: 14.169s 39.000: 16.604s 7.200: 15m29.685s 15.200: 3m36.565s 23.200: 18.532s 31.200: 14.197s 39.200: 16.262s 7.400: 15m4.914s 15.400: 3m12.127s 23.400: 12.583s 31.400: 14.238s 39.400: 16.664s 7.600: 14m42.496s 15.600: 3m5.743s 23.600: 12.471s 31.600: 13.995s 39.600: 2.631s 7.800: 14m25.474s 15.800: 3m3.774s 23.800: 12.971s 31.800: 14.904s PS C:\Users\steve> C:\Users\steve\Documents\KlipperProcesses\klipper_estimator.exe --config_moonraker_url http://192.168.0.10 estimate C:\Users\steve\Desktop\TEST.gcode Sequences: Run 0: Total moves: 992220 Total distance: 1469218.344mm Total extrude distance: 37280.289mm Minimal time: 8h9m7.475s (29347.475s) Total print move time: 5h37m39.682s (20259.682s) Total extrude-only time: 49m29.742s (2969.742s) Total travel time: 1h41m57.802s (6117.802s) Average speed: 50.063 mm/s Top speed: 412.688 mm/s Average flow: 3.055 mm³/s Maximum flow: 11.283 mm³/s Average flow (output only): 4.426 mm³/s Phases: Acceleration: 2h21m13.022s Cruise: 3h27m18.831s Deceleration: 2h20m35.372s Move kind distribution: 3h10m12.924s Perimeter 1h48m10.835s External perimeter 1h31m40.125s Solid infill 1h19m9.320s Internal infill 10m42.668s Bridge infill 8m11.492s Top solid infill 38.045s Overhang perimeter 21.186s Skirt/Brim 0.631s Custom Layer time distribution: 0.000: 0.049s 8.000: 6m5.563s 16.000: 1m17.230s 24.000: 5.647s 32.000: 6.672s 0.200: 19m40.520s 8.200: 4m56.893s 16.200: 1m25.803s 24.200: 6.387s 32.200: 5.347s 0.400: 8m48.856s 8.400: 4m58.232s 16.400: 1m23.280s 24.400: 6.734s 32.400: 5.012s 0.600: 9m29.722s 8.600: 4m56.526s 16.600: 1m23.821s 24.600: 6.549s 32.600: 5.165s 0.800: 9m36.684s 8.800: 4m55.343s 16.800: 1m22.248s 24.800: 6.603s 32.800: 5.008s 1.000: 9m6.420s 9.000: 4m51.504s 17.000: 1m19.202s 25.000: 6.796s 33.000: 4.983s 1.200: 6m30.562s 9.200: 4m43.299s 17.200: 28.533s 25.200: 5.494s 33.200: 5.028s 1.400: 6m43.275s 9.400: 4m55.601s 17.400: 20.630s 25.400: 5.846s 33.400: 5.160s 1.600: 6m37.764s 9.600: 4m47.692s 17.600: 20.059s 25.600: 5.944s 33.600: 5.204s 1.800: 6m29.135s 9.800: 4m43.251s 17.800: 19.381s 25.800: 5.946s 33.800: 5.234s 2.000: 6m24.920s 10.000: 4m34.612s 18.000: 19.371s 26.000: 5.948s 34.000: 5.089s 2.200: 6m30.885s 10.200: 4m36.867s 18.200: 19.486s 26.200: 5.950s 34.200: 5.083s 2.400: 7m1.319s 10.400: 4m20.005s 18.400: 18.985s 26.400: 5.951s 34.400: 5.085s 2.600: 7m3.364s 10.600: 4m24.105s 18.600: 18.737s 26.600: 5.963s 34.600: 4.997s 2.800: 6m54.151s 10.800: 4m22.989s 18.800: 18.371s 26.800: 5.958s 34.800: 4.967s 3.000: 6m55.210s 11.000: 4m16.035s 19.000: 16.416s 27.000: 5.960s 35.000: 4.996s 3.200: 7m45.360s 11.200: 3m37.373s 19.200: 15.959s 27.200: 5.962s 35.200: 6.181s 3.400: 8m9.727s 11.400: 3m29.041s 19.400: 15.373s 27.400: 5.973s 35.400: 6.242s 3.600: 7m48.781s 11.600: 3m24.368s 19.600: 14.379s 27.600: 6.562s 35.600: 6.094s 3.800: 7m45.760s 11.800: 3m19.090s 19.800: 13.808s 27.800: 6.829s 35.800: 6.912s 4.000: 7m52.151s 12.000: 3m20.638s 20.000: 12.787s 28.000: 6.829s 36.000: 7.224s 4.200: 7m11.772s 12.200: 2m33.382s 20.200: 9.549s 28.200: 8.227s 36.200: 6.454s 4.400: 7m0.416s 12.400: 2m28.598s 20.400: 8.696s 28.400: 7.228s 36.400: 6.574s 4.600: 6m46.888s 12.600: 2m28.542s 20.600: 8.620s 28.600: 7.264s 36.600: 6.577s 4.800: 6m49.984s 12.800: 2m28.820s 20.800: 8.582s 28.800: 7.319s 36.800: 6.122s 5.000: 6m41.999s 13.000: 2m28.193s 21.000: 8.739s 29.000: 7.072s 37.000: 6.340s 5.200: 6m39.531s 13.200: 2m25.818s 21.200: 10.053s 29.200: 6.507s 37.200: 6.326s 5.400: 6m38.993s 13.400: 2m22.769s 21.400: 9.991s 29.400: 6.432s 37.400: 6.348s 5.600: 6m36.641s 13.600: 2m22.906s 21.600: 10.099s 29.600: 6.523s 37.600: 6.237s 5.800: 6m28.176s 13.800: 2m23.566s 21.800: 10.388s 29.800: 6.544s 37.800: 6.192s 6.000: 6m19.315s 14.000: 2m25.702s 22.000: 10.390s 30.000: 6.373s 38.000: 6.170s 6.200: 6m42.480s 14.200: 2m39.416s 22.200: 9.883s 30.200: 6.224s 38.200: 6.149s 6.400: 7m1.028s 14.400: 2m30.648s 22.400: 9.779s 30.400: 6.143s 38.400: 6.133s 6.600: 6m40.661s 14.600: 2m32.304s 22.600: 9.707s 30.600: 6.158s 38.600: 6.533s 6.800: 6m33.744s 14.800: 2m32.374s 22.800: 9.696s 30.800: 6.262s 38.800: 6.645s 7.000: 6m40.363s 15.000: 2m32.444s 23.000: 9.914s 31.000: 6.210s 39.000: 6.785s 7.200: 6m30.897s 15.200: 1m26.211s 23.200: 7.133s 31.200: 6.221s 39.200: 6.735s 7.400: 6m18.743s 15.400: 1m19.127s 23.400: 5.411s 31.400: 6.242s 39.400: 6.664s 7.600: 6m9.706s 15.600: 1m16.945s 23.600: 5.449s 31.600: 6.172s 39.600: 0.735s 7.800: 6m3.446s 15.800: 1m16.600s 23.800: 5.595s 31.800: 6.620s

Without changing anything, my estimated time changed by 10 hours.

b-fitzpatrick commented 5 months ago

I updated to v3.7.2 from v3.4.0 to deal with the minimum_cruise_ratio change. I saw the same as @stevereno30: different estimates for the same input. I had similar results with v3.7.1, but v3.7.0 seems to be giving me consistent results (well, five times in a row for the same input).

dalegaard commented 5 months ago

Hi @stevereno30, @fjpanag, and @b-fitzpatrick

Sorry, I've been swamped lately and have not had a chance to look at this until now.

I've just released version 3.7.3 which should fix this and #62. If you could test it out and report back, that would be a big help. Thanks in advance.

Again sorry for the delay!

Best regards, Lasse

b-fitzpatrick commented 5 months ago

@dalegaard, I'm getting consistent and seemingly-reasonable results with v3.7.3. Thank you!

stevereno30 commented 5 months ago

No need to apologize. I can't be impatient when this is free software!

My last print estimate, post-processed with 3.7.3, was off by <3 seconds compared to actual print time. Data point of one, but that seems about as perfect as it can be!