Newbie PID advice on a retrofit BenchmanXT


Page 1 of 5 1234 ... LastLast
Results 1 to 12 of 56

Thread: PID advice on a retrofit BenchmanXT

  1. #1
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default PID advice on a retrofit BenchmanXT

    Reworking BenchmanXT Small milling machine. I have the X and Y axis wired to Channels 0 and 1 respectively. I am attempting the PID tuning and just wanted someone with experience to tell me if I have correctly tuned these two PID advice on a retrofit BenchmanXT-pidchan1-jpg PID advice on a retrofit BenchmanXT-pidchan0-jpg I have a 50000 count per inch encoder on each axis so I am moving one inch in the Step Response screen. I THINK this is good but wanted to ask if someone sees something I need to change.

    Thanks!

    Similar Threads:


  2. #2
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2379
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi steve_alaniz,

    Its hard to see how well you are doing on that scale by trying to see the small difference between the red and blue plots.

    Zooming in or plotting position error would show much more.

    Better yet if you include the data so we can zoom in and re-plot it however we wish.

    Instead of taking a photograph - take a screen capture with Alt-Print Screen, then paste into something like Paint, and save as a *.png file.

    The output (green plot) needs to go to ~900 for your test motion. Your limit on the Integrator of 500 means that the Integrator will likely saturate and stop helping at some speed. Probably a Max Limit I of 2000 would be better.

    You didn't show us your Filter Settings. Usually a 2nd Order Low Pass filter Freq=1000 Q=1.4 in the 3rd filter is helpful.

    Your Velocity of 4 million counts/sec is way too high. Max encoder count rate of KFLOP is 1 million counts/sec. The motion you are testing is only reaching 300,000 counts/sec because of the relatively short move distance and limited Acceleration and Jerk. You might read this article:

    Dynomotion

    HTH
    Regards





    Instead of taking pho

    TK
    http://dynomotion.com


  3. #3
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,
    Thank you for the reply and advice. I can't say I exactly understood what you said. I have not been using any filters. I was not aware I needed to but added it to each of the axis with the parameters you suggested. You said the third filter... I assume that is filter number 2 since that is the third filter. I lowered the velocity to 700,000 and ran the tests. I play a bit more with the PID settings. It is a bit confusing that you said a lower acceleration would help determine the max velocity. I would have thought just the opposite so I was in trouble with understanding that part from the start. Anyway, here re results from today. PID advice on a retrofit BenchmanXT-xaxis-pngPID advice on a retrofit BenchmanXT-xaxiszoom-pngPID advice on a retrofit BenchmanXT-xaxis-pngPID advice on a retrofit BenchmanXT-yaxiszoom-png
    I have the data files but I don;t see how to include them here.
    Looking at the zoomed in plots I would think that I need more I. The Green line seems to indicate that the drive is fast enough to catch up and it slows down and adjusts the position to be close to the commanded plot but doesn't quite reach it. Adding more I should solve that but then I get a big overshoot when it flattens out and it rings a little until it settles, the same at the bottom. I could up the I and the D so that the D dampens the overshoot but that already seems high and I think that would cause a lag in the position following so I am reluctant to do that.
    Also, I have read up on PIDs but I havn't seem anything that tells me what the filters do. Is there a place that tells how this works in a nutshell?

    Any thoughts?
    Thanks
    Steve

    Last edited by steve_alaniz; 07-17-2016 at 11:50 AM. Reason: new thoughts


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

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,
    I have not been using any filters. I was not aware I needed to but added it to each of the axis with the parameters you suggested. You said the third filter... I assume that is filter number 2 since that is the third filter.
    Correct. With a screen shot we could have checked if you did it correctly.

    I lowered the velocity to 700,000 and ran the tests.
    That still had no effect and may as well have been set to infinity. The top speed you moved was ~140,000 counts/sec. That is sort of like saying you have a car that can go 300MPH but only test it in a parking lot never going over 30MPH. If you ever take it on the highway you may find it fails above 100MPH.

    It is a bit confusing that you said a lower acceleration would help determine the max velocity. I would have thought just the opposite so I was in trouble with understanding that part from the start.
    Sorry I was confusing. The idea is that a motor axis has torque and speed limitations and you should determine and understand what they both are for your system. Available motor torque drops off with higher speed. At some speed the motor will not even be able to generate any torque at all. Motor torque is required to accelerate the axis. We need to make sure that no combination of velocity and acceleration will ever cause the axis to fault/stall/fail. So there is often a complex set of speeds and accelerations that will work ok that form an envelope of workable speed and acceleration. So one nice thing to know is top speed possible. It is like taking your car out on a long straight highway and gradually accelerating to find the max speed is 100MPH. You will then know that ever attempting a speed over 100MPH will always fail. Also speed should probably be limited something like 80MPH to allow for margin and to allow reasonable acceleration up to that speed. The reason for performing the top speed test at low acceleration is to avoid a failure because of not being able to accelerate at the specified rate. So we want to set the acceleration to a low value so it will not be a limiting factor when determining top speed. However if we set the acceleration so low with a short trip distance we will never go very fast and the speed test will be meaningless. That is exactly what you did. The max speed you tested was 140,000. Change the Plot type to Velocity, Output, vs Time to clearly see this.


    To accelerate to 700,000 counts/sec at an acceleration rate of 700,000 counts/sec^2 would take 1 second. And then to slow back down would take 1 more second. So at least 2 seconds of motion would be required to get to full speed. Your 100,000 count (2 inch) move takes much less than that. Furthermore you have a relatively low Jerk setting (1e6). This means the acceleration will be applied gradually over 0.7 seconds. This means an even much longer time and distance would be required to achieve top speed.

    Here is the method I usually follow to find 2nd/3rd order motion profile limits:
    (note every system is different and will vary based on resolution, motor size/type, mass, etc...)

    #1 - Find Max Velocity at low Acceleration and infinite Jerk

    Choose a Velocity to test (ie V=100000 counts/sec)
    Set a moderately low Acceleration Time of 1 second (A = V/1sec = 100000 counts/sec^2)
    Set very high Jerk so Acceleration is applied almost instantaneously in 0.001 sec (J = A/0.001sec = 1e8 counst/sec^3)
    Test a very long move 20 inches if possible (for resolution 50000 counts/inch, 1,000,000 counts)
    Plot Velocity, Output, vs time to see if V is actually obtained
    If the motion was successful repeat all above with higher V, if not try lower V

    Once Max V is found reduce by some margin (ie 20-50%)

    Note you may decide on lower speed for other reasons (safety, vibration, noise, wobble, shock, etc....)


    #2 - Find Max Acceleration for your system for the chosen Velocity

    Using the V found above increase A (keeping Jerk high in the same manner) until the system fails/faults/excessive shock, etc...

    Once Max A is found reduce by some margin (ie 20-50%)

    These V and A Values are now known good values for your system and can be used for 2nd order motions such as KMotionCNC Trajectory Planner or Mach3 Motor tuning. Note units will need to be converted (counts to inches or mm, time from seconds to minutes depending on the App)

    #3 - Find optimal 3rd order Jerk limited motions.

    The previous result from Step #1 and #2 used nearly infinite Jerk where Acceleration forces were applied nearly instantaneously. By reducing Jerk smoother motion should be possible.

    Set Jerk so it is applied over 20ms (ie for A=200000 J = A/0.020 = 1e7

    Test to see if motions are smoother. With closed loop systems the Position Error Plot can be used to see if the motion has less error and is smoother. Open loop system will require you to hear the difference.

    Increase/decrease Jerk to find the optimal value. Note reducing Jerk a lot will of course make the system very smooth, but will also be much slower using less acceleration and velocity which is undesirable. So the highest Jerk possible should be found that still provides some smoothness.

    Reducing Jerk only will always make the system slower with less performance (but hopefully significantly smoother). It is usually then possible to increase Acceleration and Velocity somewhat to achieve even higher performance than what was possible with infinite Jerk while being as smooth or smoother.


    I have the data files but I don;t see how to include them here.
    The cnczone Advanced Posting Page has a "Manage attachments" button to allow you to upload file. .txt files are limited to 500KBytes and the raw data plot files are usually bigger than that. So you will need to compress them and upload the compressed file. I like to use 7-Zip. It is a free program that allows you to just right-click on the file and compress it.

    The Green line seems to indicate that the drive is fast enough to catch up and it slows down and adjusts the position to be close to the commanded plot but doesn't quite reach it. Adding more I should solve that but then I get a big overshoot when it flattens out and it rings a little until it settles, the same at the bottom. I could up the I and the D so that the D dampens the overshoot but that already seems high and I think that would cause a lag in the position following so I am reluctant to do that.
    Its hard to see because you didn't include a Position Error Plot. If higher D is stable you should use it and not be worried about lag. Higher P and I gains should eliminate the Lag.


    I have read up on PIDs but I havn't seem anything that tells me what the filters do. Is there a place that tells how this works in a nutshell?
    Unfortunately filters are complex. You need to be able to think in the frequency domain. You might look up terms like Low Pass filters, Lead-Lag Compensators, Notch Filters, Bode Plots.

    HTH
    Regards

    TK
    http://dynomotion.com


  5. #5
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    Thanks for the good information and your patience. Part of my problem was not understanding the settings in the Kmotion screens... a bit clearer now. I studied your suggestions for tuning and did my best to implement them. Unfortunately, this is a small mill so the most it can travel in the X axis is 12.5" and, of course, the Y is even shorted. The Y is listed as 7" so, allowing for a margin of error, it's hard to strictly follow your instructions. I decided that I would have to up the acceleration to about double what you suggested to try to get results in about 10" Not sure how valid this will be but I THINK I got what I was looking for. I THINK what I was supposed to do is push the X axis until Velocity peaked out so that I could know what the maximum would be.
    PID advice on a retrofit BenchmanXT-xaviszoom720-png PID advice on a retrofit BenchmanXT-xavis720-png
    This looks like it's telling me I went 400000 counts in 1/2 a sec. before it peaked out. That would be convenient. I am familiar with DC motor curves and the rule of thumb is that half speed gives half torque so it is the best compromise for the two values I decided to settle on 272500 as an acceleration value just to be safe. I have already managed to break a drive belt so I wanted to take it easy.
    I did more tests and at the end of the day I came up with these.
    PID advice on a retrofit BenchmanXT-xavis720b-pngPID advice on a retrofit BenchmanXT-xavisvel720b-pngPID advice on a retrofit BenchmanXT-xavispos720b-png
    And a filterPID advice on a retrofit BenchmanXT-xavisfil720b-png
    For the Y PID advice on a retrofit BenchmanXT-yaxiserr720b-pngPID advice on a retrofit BenchmanXT-yavispos720b-pngPID advice on a retrofit BenchmanXT-yavisvel720b-png\
    And the same filtering as the X axis. Does this look like I'm getting there?
    (Added the data files too)

    Attached Files Attached Files
    Last edited by steve_alaniz; 07-21-2016 at 12:27 PM. Reason: Additional files


  6. #6
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,

    I was looking at the data files and wonder if they are compatible with PID tuning software. I would guess that they are with minimal modification. Are you aware of any tuning software package that might accept these files and give some predictive results?

    Steve



  7. #7
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2379
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve

    The first plot shows the velocity max's out at ~540000 counts per sec. Notice when the blue commanded velocity exceeds this the red plot flattens out and the output (green) saturates higher with no effect?

    Many of your plots have oscillations indicating marginal stability.

    Plot #3 shows a sustained error as ~ -40 counts. The Integrator should correct any sustained errors. This indicates the Integrator limit is too low. You probably need to increase it by ~500 because we can see that a position error of ~40 counts x P gain of 11 is needed to achieve speed.

    The 2nd order low pass filter looks to be entered correctly.

    No I'm not aware of any tuning software package that would help.

    Regards

    TK
    http://dynomotion.com


  8. #8
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Tom,


    OOPS, wait I figured it out!



    Many thanks for the great advice you gave in the tuning, I have a few more issues I am working through but I did manage to create an initialization profile for Kmotion. It all looks good except that the Z axis is reversed. The up arrows give downward motion and the down raise the Z axis. I looked at the c program and it seems it is just passing parameters to the Kmotion program. I read that the gains might have to be inverted but I don't see those anywhere. Any ideas on that?

    Thanks
    Steve

    Last edited by steve_alaniz; 08-08-2016 at 07:40 PM.


  9. #9
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2379
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    To reverse the direction of a working servo both the output drive and feedback must be reversed. For a DC motor driven by SnapAmp the simplest method is to reverse the DC motor wires and change the sign of the encoder InputGain0 value.

    HTH
    Regards

    TK
    http://dynomotion.com


  10. #10
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    OK NEW question. I have all three axis going and looking really good. I've wired up the spindle motor. It is an AC motor with an encoder hooked up to an Allen Bradley digital drive. It takes in an encoder that is supposed to be 2000 counts per rev. I believe it reads the encoder and then passes the differential signals out so I can read them if I choose. The control voltage to the drive is plus or minus 10V just like the servos. The question is, do I hook this up as a DAC open loop or as if it were another Servo. Problem with being a servo is I'm looking for a target velocity not a position. I hope to do rigid taping at some point so I think that means I need to configure it in the threading configuration. I've done that but I can't see anything that tells me the encoder counts are even being used. SO the bottom line is, how should I configure this motor?

    Ok while I'm at it. There are a couple of pots on my front panel that allow for changing the Spindle speed and feed rate. Is there an example on how to do that. There are also buttons on the front panel that clamp and unclam the draw bar, lift the tool changer... things like that. I can wire them into the Opto inputs, but then how do I define what actions to take?

    Thanks
    Steve

    Last edited by steve_alaniz; 09-02-2016 at 04:49 PM. Reason: Added question


  11. #11
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2379
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Hi Steve,

    You would hook up the spindle the same regardless of how you want it to operate (open loop or closed loop). DAC to Drive analog input, Encoder Output to Encoder Inputs.

    To drive the spindle at some velocity the axis will be commanded to Jog.

    With the encoder feedback connected you should see position changing on the KMotion Axis Screen.

    Configure the KMotionCNC Threading parameters as described here:
    Tool Setup Trajectory Planner

    After that the True Spindle Speed should display on the KMotionCNC Main Screen.

    Regarding Pots for SSO and FRO see the example:
    C:\KMotion433\C Programs\SetFROwithPot.c

    And attached a similar example for SSO.

    HTH
    Regards

    Attached Files Attached Files
    TK
    http://dynomotion.com


  12. #12
    Registered
    Join Date
    Aug 2012
    Location
    United States
    Posts
    32
    Downloads
    0
    Uploads
    0

    Default Re: PID advice on a retrofit BenchmanXT

    Thanks Tom,

    I believe I see what happens. Threads are several c programs that run in turn in a continuous loop with the servo routine executing in between all the threads. The threads service things like the push buttons and potentiometers on the front panel. I think I understand now. At first I thought I would have to combine all these programs into a single master C program but this makes life so much easier!
    I have studied the CNC Spindle overview and I think I understand it but I have a couple of things on which I'm unclear. I see that the example is just a theoretical one and the numbers were chosen for clarity but I'm just not getting it. The example seems to setup the parameters for an easy example such that JOG command (in this example) is a percentage value. i.e. Jog0 = .25 gives a velocity 25% of full speed. "This demonstration Move profile moves at 0.5 counts/sec which results in half of the full DAC output range (1023 counts or 5V analog). " "Any Velocity Range could be used because this is only a theoretical velocity profile and can be scaled to any proportion by the Velocity Feed Forward. 1.0 counts/s is used to keep the math simple" the Jog<N>=<V> command in help says that V is position units per second. So with (V) .5 counts/second x (VFF) 2047 = Appox 1023 or half speed. Does this mean this example can never go full speed since the .5 count /sec will limit the top speed? In my case I have a (theoretical) 5000RPM and the sheets show a 2000 lines per rev encoder so 2000*5000/60) gives 166,667 counts per sec at 5000RPM. I assume this the the value I would use for the Factor definition? And My V in the motion profile should also be 166,667?
    Just trying to get this nailed down. I woun't be completely done just yet but I can be making chips with what I have in a week so this is really getting to the exciting part.

    Thanks!
    Steve



Page 1 of 5 1234 ... LastLast

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

PID advice on a retrofit BenchmanXT
PID advice on a retrofit BenchmanXT