Help with Accurate Servo Tuning


Results 1 to 16 of 16

Thread: Help with Accurate Servo Tuning

  1. #1
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Help with Accurate Servo Tuning

    Hi Guys,

    Just wondering if I can get a hand with the servo tuning, this is for a 3 axis Hurco KMB-1 with the following specs
    - Kflop with Kanalog
    - Using Existing servo motors and old drives
    - New VFD
    - Limits tested and working, Motors tested and working
    - New 1000 count encoders tested and working

    What I don't really have a good handle on is the tuning of the Servo's and the filters etc you can apply etc.

    If you could look at these results from the Y-axis and tell me what I should be doing differently also do you tune with the step or the move button? Axis is 20000 counts/inch or 787 counts/mm.

    Help with Accurate Servo Tuning-y-axis-jpg

    I tried to attach a text file of the data but the site limits that to 500k so I had to rar it.

    Cheers

    Chris

    Similar Threads:
    Attached Files Attached Files


  2. #2
    Member
    Join Date
    Jan 2007
    Location
    Canada
    Posts
    599
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Just wondering what "Output" means in the Kanalog world. When I look at the Command and position, I'd say thats looking pretty good.......



  3. #3
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Output is the signal sent to the DAC to drive the Servo. Signal is 0-2048 corresponding to 0-10V dc.

    Cheers

    Chris



  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    After you are tuned well enough that he following error is small and hard to see on the Command & Position Plot it is better to switch to showing error as I Plotted here:

    Help with Accurate Servo Tuning-y-axis-error-png

    The error is ~50 counts which corresponds to 50/20000 = 0.0025 inches. Note the error persists throughout the move because the I gain is so low as to only gradually start to make any correction over the ~1 second of motion. Increasing I gain should cause the error to be driven down during the move.

    But first can you increase the P Gain further?

    Adding Damping (D Gain) may help to allow you to increase P Gain further. Because D Gain (which is a derivative) can make the Output noisy or with spikes, a 2nd order Low Pass filter (Freq=1000Hz Q=1.4) is normally added in the Last IIR Filter (so it is also applied to any Feed Forward). Adding the low pass filter should reduce the noise and spikes in the output. A reasonable numeric value of the D Gain is normally several times the P Gain numeric value.

    The Axis is moving relatively slowly 7000/20000 = 0.35ips = 21 ipm. Test and tune at various velocities including your maximum intended velocity.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  5. #5
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    HI Tom,

    Ok I will try all that, I am no machine operator I am just doing all the work What sort of speeds are standard for a 3 axis mill? in ipm?

    Cheers

    Chris



  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    I would expect maybe 150ipm? You are currently using ~160 of 2047 DAC Counts to go 21 ipm. So max 10V to the Drives should be around:

    2047/160*21= 269ipm

    You will need to increase your Max Output and Max Integrator to 2047 to allow full +/-10V Output.

    Regards

    Regards
    TK http://dynomotion.com


  7. #7
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Tom,

    I followed you advice and upped the P gain, If I go much higher it gets unhappy with me, same with the I and the D. I also upped the speed to match the rated original speed of the machine of 250ipm for Rapid traverse and tried tuning there. Once I got it as best as I could I lowered the speed to the 100ipm feed rate listed in the manual and took a plot at that speed. Looks like the error gets much better at the lower speeds but I would love some advice as what to do next

    I did put in the filter you suggested also.

    Fast Rapid
    Help with Accurate Servo Tuning-y-axis-fast-jpg

    Slower max cutting speed
    Help with Accurate Servo Tuning-y-axis-slow-jpg

    Cheers

    Chris

    Attached Files Attached Files


  8. #8
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    Notice at the higher speed there is still persistent error while moving of ~80 counts. This is caused by the combination of High speed, Hi Damping (D Gain), and the Integrator Limiting to 2000 DAC Counts.

    At the higher speed an Output of ~1800 DAC counts is required for the amplifier to move at that speed.

    See this Diagram how the P I D Terms sum together to form the output.
    Help with Accurate Servo Tuning-servoflowdiagram-png

    Assume that we expect to have zero error while moving at 80,000 counts/sec. This means that the P term will have no contribution and can be ignored.

    The D term with D gain=120 will be applying a "drag" of:

    80000 counts/sec x 90us x 120 = 864 DAC Counts

    So the I Term must rise to 1800 + 864 = 2664 DAC Counts

    Limiting it to 2000 it will be 664 DAC Counts short which the P Gain will need to supply causing an error of

    664 / 8.4 = 79 encoder counts

    So in summary, increase the Max Integrator to 3000

    Otherwise the errors seem reasonably small except when accelerating. Acceleration of 500000 counts/sec^2 / 20000 counts/inch = 25 in/sec^2 = 0.07G You might want to decrease acceleration to reduce following error.

    In some cases a lead-lag compensator can work better than the D Gain. You would need to obtain a good Bode Plot Measurement to be able to optimize the lead lag compensator.

    Feed Forward can help reduce following error alot. However you should be aware that feed forward is open loop. Under changing load (cutting forces) and varying friction it may not help as much as plots indicate under no loads.

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  9. #9
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Tom,

    Thanks again for all your help!!

    I did as you suggested and increased the Max Integrator to 3000 which removed almost all errors once it is at speed. The error during acceleration seems to be directly related to the acceleration rate. For example at 200,000 accel I get 20 counts error at 300,000 I get 30 counts error etc. What controls the error during acceleration?

    Help with Accurate Servo Tuning-y-axis-11_12_15-jpg

    I also attempted to tune X and Z axis. X tuned fine but Z seems to be giving me a bit of an issue...

    Help with Accurate Servo Tuning-x-axis-11_12_15-jpg

    Help with Accurate Servo Tuning-z-axis-11_12_15-jpg

    I also tried a bode plot of the Y Axis but I am not sure exactly what I am doing?? Can you suggest some parameters?

    Help with Accurate Servo Tuning-bode-y-axis-11_12_15-jpg


    Aside from the tuning I have a few issues maybe you can comment on:
    1.) When I hit my estop which just cuts the main DC power to the servo drives and then release it sometimes the system goes into a horrible oscillation which I can fix by just disable and then enable in Kmotion. What am I screwing up?
    2.) Is there a way to write a C program or similar that runs continuously such that when an input triggers (mechanical timer) it turns on an output (lube pump) for 3 minutes then waits 5 mins before checking for that input again?
    3.) How do I setup the Flood and Mist outputs in Mach 3? I have 2 outputs which drive the pump for flood and the solenoid for mist on Kanalog.
    4.) Unrelated to Kmotion but do you know if there is anything I can do to stop the high pitched whine coming from the servo motors? This occurs all the time even when Kflop/Kanalog is not powered, the drives have pots for Signal Gain, Tach Gain, Balance, Time Constant, Current Limit.

    Data Files attached.

    I will be working on this Sunday hope to make some chips even if I have not fully tuned the axis.

    Cheers

    Chris

    Attached Files Attached Files


  10. #10
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    The error during acceleration seems to be directly related to the acceleration rate. For example at 200,000 accel I get 20 counts error at 300,000 I get 30 counts error etc. What controls the error during acceleration?
    Your amplifiers are in velocity mode. As speed increases the Output must increase. The Integrator term is what causes the output to Ramp up. Higher I gain will cause the output to ramp up at the acceleration rate with a smaller error. A double integrator would be required to have zero error under constant acceleration. Torque mode adds an extra integrator. Having a double integrator tends to make the system less stable. Velocity Feed Forward can be used to reduce the error while accelerating. It basically says when the system is moving at the current velocity we know the output needs to be nominally at a certain amount so apply it. I don't know what your requirements are but a 1mill error under full acceleration is normally not too bad.

    I also attempted to tune X and Z axis. X tuned fine but Z seems to be giving me a bit of an issue...
    Seems to be nearly unstable. You will probably need to reduce or adjust gains.

    I also tried a bode plot of the Y Axis but I am not sure exactly what I am doing?? Can you suggest some parameters?
    To get a useful Bode Plot measurement it is imperative to excite the system with the right amount (and frequency range) of stimulus. Too little encoder motion will not provide good data. Too much Output will saturate the amplifier and give false results. The stimulus cutoff frequency can be used to reduce the amplitude of the higher frequencies of the stimulus that the servo is not capable of following. So the first step in making a Bode Plot measurement is to use the Time Domain Plot to adjust the Stimulus.

    When I hit my estop which just cuts the main DC power to the servo drives and then release it sometimes the system goes into a horrible oscillation which I can fix by just disable and then enable in Kmotion. What am I screwing up?
    If the axis are left enabled with the amplifiers disabled then the servos will ramp up to full output trying to reduce any error. Also the error is likely to grow to a huge value. When the amplifiers are re-enabled there will be a violent reaction. You might input the estop signal to KFLOP so it can be aware of the estop condition and disable the axes. Alternately a small following error limit might be used to disable the axis if there is an error when the amplifiers are disabled. Then a re-initialization can enable the axes in an orderly manner.

    Is there a way to write a C program or similar that runs continuously such that when an input triggers (mechanical timer) it turns on an output (lube pump) for 3 minutes then waits 5 mins before checking for that input again?
    Yes. Add a monitoring loop at the end of your initialization C Program to handle this. Detect when the input changes, set the output, and record the time using Time_sec(). When the current time is 3 minutes later turn off the output, etc...

    How do I setup the Flood and Mist outputs in Mach 3? I have 2 outputs which drive the pump for flood and the solenoid for mist on Kanalog.
    Configure the bit numbers in Mach3 | Ports and Pins | Outputs

    Unrelated to Kmotion but do you know if there is anything I can do to stop the high pitched whine coming from the servo motors? This occurs all the time even when Kflop/Kanalog is not powered, the drives have pots for Signal Gain, Tach Gain, Balance, Time Constant, Current Limit.
    Does the noise go away if you turn down the Tach or the Signal Gains?

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  11. #11
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Tom,

    I will keep playing with the Z axis then.

    This is what I got for a Time Domain Plot on the Bode Plot screen, what am i trying to get this to look like?
    Help with Accurate Servo Tuning-bode-y-axis-11_15_15-jpg

    Data file also attached.

    I have now connected the Estop to Bit 142 Opto IN 6 and I have it setup in Mach 3 so it does trigger the Estop but it does not disable the axis atm. Is this something I need to do in C code in Kmotion or is it a setting in Mach 3?

    I have setup the Mist and Flood thanks!

    Cheers

    Chris

    Attached Files Attached Files


  12. #12
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    This is what I got for a Time Domain Plot on the Bode Plot screen, what am i trying to get this to look like?
    That looks reasonable and should provide a useful Bode Plot. Note the encoder quantization error (steps in the red plot) are relatively small showing reasonable Position information. The Output is only going +/-100 DAC counts (+/- 5%). Slightly higher Amplitude (2X?) may improve the measurement resolution. Note the servo (red) only grossly follows the command (blue) so the command contains a significant amount of frequencies that are beyond the servo's capability. A lower cutoff frequency might be appropriate and put more of the stimulation in frequencies of interest.

    Now make a frequency domain measurement. A good Bode Plot will help us design a useful lead/Lag compensator that may work better than D Gain.

    I have now connected the Estop to Bit 142 Opto IN 6 and I have it setup in Mach 3 so it does trigger the Estop but it does not disable the axis atm. Is this something I need to do in C code in Kmotion or is it a setting in Mach 3?
    I'm not sure I understand but you might have a loop in KFLOP monitoring the EStop Input and perform any other actions you desire such as disabling axes.

    Regards

    Regards
    TK http://dynomotion.com


  13. #13
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Tom,

    Long time Got distracted by some other projects but I am back on this and also another system but I will start a new thread for that.

    Here is the latest Bode plot I got for the y-axis:
    Help with Accurate Servo Tuning-bode-y-axis-11_19_15-jpg

    I also managed to get the Estop setup correctly in Mach and Kmotion so when it estops the axis gets disabled correctly.

    Cheers

    Chris

    Attached Files Attached Files


  14. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    Can you "read" the Phase Margin from the plot? Hint: Phase Margin is how close the phase (green plot) is to -180 degrees at the frequency where the Magnitude (blue) crosses the 0db line.

    You should normally have at least 30 degrees for a good stable system.

    Regards

    Regards
    TK http://dynomotion.com


  15. #15
    Member
    Join Date
    May 2013
    Location
    USA
    Posts
    62
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    HI Tom,

    I am not sure what you mean, from what you suggest the green plot is close to +180 when the blue crosses 0db?

    Cheers

    Chris



  16. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Help with Accurate Servo Tuning

    Hi Chris,

    That is correct. It would indicate a nearly unstable system (lots of overshoot ringing and close to breaking into violent oscillation).

    Improvements would be to reduce gains to shift the Magnitude plot downward while not changing the phase. This would shift the crossover point to the left increasing Phase Margin.

    The other approach would be to change the phase plot. More D Gain should add positive phase. Or use a lead-lag filter to add phase.

    But then Bode Plots don't always reflect reality if measured with improper stimulus.

    Regards

    Regards
    TK http://dynomotion.com


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Help with Accurate Servo Tuning

Help with Accurate Servo Tuning