Back to top

Autotuning Start command

0 votes
+ vote
Vote up!
Hello, I have a question, I am programming the AKD KOmorgen with the Python script and want to program an autotuning with the AKD
Unfortunately, I couldn't find any commands for autotuning in the user manual, but only for manual
Could you please tell me what are the command for autotuning
Thanks you very much
Kind regards

3 Answers

0 votes
+ vote
Vote up!

There are multiple ways to control an AKD via Raspberry PI. Here three of which I played around a little

  • Codesys. There is a full Codesys library for the Raspberry PI which even allows the PI to be an EtherCat Master. This way you can do PLC programming and Motion in PLCOpen. The full version needs to be purchased, but a test version which runs two hours in line is available for free.
  • Python. Telnet is supported by Python with this interface you achieve similar as was workbench does. Use the "telnetlib" library.

socket = telnetlib.Telnet(, timeout = 2)   # start telnet connection to IP-address

socket.write("VL.FB\r\n")   # request to read actual velocity

answer = socket.read_until("-->", timeout = 2)    # drive response containing actual velocity

socket.close()    # end telnet session. Telnet only allows for one connection at a time


Thank you so much , i wILL try it :D

knight1504 - Thu, 09/26/2019 - 05:40

I did an experiment, and it worked, thank you very much.
Unfortunately there is a small problem, I can only print one value of the speed although the motor runs for 20 seconds.
Can i somehow print and stream in realtime all vl.fb values and save them in a csv or excel file?
Thank you so much

knight1504 - Thu, 09/26/2019 - 08:32

Just do the same in a loop.
import telnetlib

TnConn = telnetlib.Telnet("", 23, timeout = 1)
LogFile = open("VelocityFB.csv", 'a')
while True:
TnConn.write(str.encode("VL.FB" + "\r\n"))
ParamValue = TnConn.read_until(str.encode("-->"), timeout = 1).decode()
if ParamValue.startswith("-->",0,3):
ParamValue = ParamValue[3::]
if ParamValue.endswith("-->"):
ParamValue = ParamValue[:len(ParamValue)-5]
LogFile.write(str(ParamValue) + "\n")
except KeyboardInterrupt:
This is probably answered in better way on

Martin Rupf - Thu, 09/26/2019 - 22:59

Thank you very much , when should i send the Command "vl.cmdu" , before the Loop Or in the Loop
And can you tell me what is 0 and 3 in the command if ParamValue.startswith("-->",0,3):
Thank you for your help

knight1504 - Thu, 09/26/2019 - 23:36

As VL.CMDU is endless I would call it before the loop and then in the cleanup again to stop the motion

For python commands I use as help

Martin Rupf - Fri, 09/27/2019 - 00:07
Log in or register to post comments

0 votes
+ vote
Vote up!

We do not have experience with Python programming or the Raspberry Pi.

If it supports sending Telnet commands or alternatively Modbus TCP then in general it should work.

Per Workbench Help:

VL.CMDU sets the user velocity command. When DRV.OPMODE is set to 1 (velocity loop) and DRV.CMDSOURCE is set to 0 (TCP/IP channel), then setting this value when the drive is enabled will cause the drive to rotate at the required velocity.

I would encourage you to use Workbench terminal to first test your commands and sequence. I would always test this using Terminal before trying to do the same thing with your external program.

For example I typed the following in Terminal. First I enabled the software enable then I set the VLCMDU ( with the drive in Service Velocity mode ). In my case the drive velocity units were setup for RPM in the Units screen under the Axis->Settings of the online drive tree. Next I queried the Velocity Loop Feedback ( in Terminal I used repetitive VL.FB commands to return a value. We do not have a velocity regulation specification for the AKD as how well it regulates is a function of the load, mechanics, tuning/gains, etc. You can also use the Watch window to monitor the velocity. Lastly I disabled the software enable.

-->VL.CMDU 100
96.285 [rpm]
97.430 [rpm]
101.359 [rpm]
98.740 [rpm]
101.822 [rpm]
102.469 [rpm]

If the chain of commands work in Terminal but not in Python then you have a programming or communication issue.

I would also suggest you reach out to your local Kollmorgen distributor who you purchased the AKD drive from for local support.

I hope this helps!


Thank you so much for your answer
I have used those command but i got always the Fault F301 : Motor Overheat ?
shoud i command anything more but not OnLy VL.CMDU ?

knight1504 - Thu, 09/26/2019 - 05:39
Log in or register to post comments

0 votes
+ vote
Vote up!

There is no parameter/keyword equivalent to the "Start" in the Performance Servo Tuner in the AKD.

This is because standard practice is to use Workbench to commission the AKD which includes basic setup ( i.e. motor, feedback, units, command source, op mode, etc. )

and tuning the drive. You will need to use Workbench for the PST functions.

Generally once the drive is setup and commissioned for the application then external access will involve things like changing setpoints, limits, commanding to home or move, diagnostics ( read fault codes ), etc. for example.


Thank you for your quick response
Is it possible that I program in Python in such a way that I enter the target value for the speed and then the motor runs exactly as well as the desired speed without using the Workbench ? Because I want to control the Kollmorgen with Raspberry pi
Can you please also check the following code why the Moter is not running ?
Thank you very much.
Inverter.drv.opmode(1) <= Velocity mode
Inverter.cmdsource(0) <= Telnet/TCP/IP

knight1504 - Wed, 09/25/2019 - 07:55
Log in or register to post comments
You may login with either your assigned username or your e-mail address.
The password field is case sensitive.

If you do not have an account, click here to register.