Macro for Testing Max Accleration
-
I where looking for a easy method to test how much Accleration i could potentially run on my Printer.
Klipper has that nice macro written by Andrew Ellis that makes it easy to run tests Automated so ive looked into creating something similar to test how far i can push the Accleration at a set speedResulting in the Following Macro
;-------------------Accel Test Macro---------------------------------------------- ;this Macro aims to create random movements at set speed and set Accel ;There is a chance that this macro causes a Rapid Movement towards the Min Axis point the macro takes X0 and Y0 as Origin ;aviable macro parameters: ; S = max speed in mm/min ; I = Max Iterations ; A = Accleration Increment ;move.axes[0] X Axis ;move.axes[1] Y Axis ;move.axes[2] Z Axis ;--------------------Variables--------------------------------------------------- var xmax = floor(move.axes[0].max-5) ; Grab Max Distance in X var ymax = floor(move.axes[1].max-5) ; Grab Max Distance in Y var xmaxspeed = move.axes[0].speed ; Grab Max Speed in X var ymaxspeed = move.axes[1].speed ; Grab max Speed in Y var maxspeed = 0 ; Placeholder for Max speed var maxiterations = 5 ; how often does the Macro gets repeated var maxmoves = 30 ; how many moves are made by the macro var xaccel = move.axes[0].acceleration ; grab XAccel from config var yaccel = move.axes[1].acceleration ; grab YAccel from config var accel_inc = 0 ; increment accleration by this value each iteration ;------------------Functions---------------------------------------------------- set var.maxspeed = var.xmaxspeed > var.ymaxspeed ? var.xmaxspeed:var.ymaxspeed ; get max configured speed for the test if exists(param.S) set var.maxspeed = param.S ; Overwrite Max Speed from Macro parameter if set if exists(param.I) set var.maxiterations = param.I ; Overwrite Iterations from macro parameter if set if exists(param.A) set var.accel_inc = param.A ; Overwrite accel_inc from a macro parameter if set ;------------------Prepare Printer---------------------------------------------- if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 ; Home Axis if not Homes G1 Z20 ; Clear Bed M400 ; Wait for movements to finish ;-----------------Test Gcode---------------------------------------------------- echo "running Accel Test" echo "Max Speed:",var.maxspeed echo "Iterations:", var.maxiterations while true M400 ; Wait for all movements to finish M201 X{var.xaccel} Y{var.yaccel} ; set Accel if iterations = var.maxiterations abort "finished Accel Test" ; Loop until max repats are reached echo "running Iteration", iterations echo "X Accleration", var.xaccel echo "Y Accleration", var.yaccel set var.xaccel = var.xaccel+var.accel_inc ; increment the X axis accleration for the next loop set var.yaccel = var.yaccel+var.accel_inc ; Increment the Y axis accleration for the next loop while true if iterations = var.maxmoves break var xrnd = random(var.xmax) var yrnd = random(var.ymax) G1 F{var.maxspeed} X{var.xrnd} Y{var.yrnd} ; Move X and Y in random directions at set speed M400 echo "restart the Mainboard or Reload the Config file again to reset Accleration to its original value" M2
This Macro takes the machine limits in X and Y (expecting Home to be at the Min point)
and then puts random movements within the Machine Limit at the set speed and Accleration
by default it doesnt increase the Accleration with each Iteration but can be configured to do so with a Parameter attached to the Macro Callits not perfect but gave me useable results
might be helpful for others so i post it here.Something to consider because of the Random Movements is that its not 100% repeatable but should give more realistic results due to being closer to actual print movements
-
@Superbrain8 I have a similar one here https://forum.duet3d.com/topic/32433/determining-max-speed-and-acceleration
-
@jay_s_uk didnt really showed up when searching for it, the pinned macros showed up but they are a bit bulky