Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Macro for Testing Max Accleration

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    macro tuning accleration
    2
    3
    214
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Superbrain8undefined
      Superbrain8
      last edited by

      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 speed

      Resulting 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 Call

      its 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

      jay_s_ukundefined 1 Reply Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @Superbrain8
        last edited by jay_s_uk

        @Superbrain8 I have a similar one here https://forum.duet3d.com/topic/32433/determining-max-speed-and-acceleration

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        Superbrain8undefined 1 Reply Last reply Reply Quote 0
        • Superbrain8undefined
          Superbrain8 @jay_s_uk
          last edited by

          @jay_s_uk didnt really showed up when searching for it, the pinned macros showed up but they are a bit bulky

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA