Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > On Sun, 2007-10-14 at 19:42 -0500, Chris Radek wrote: > >>On Sun, Oct 14, 2007 at 05:39:02PM -0700, Kirk Wallace wrote: >> >>>In case anyone is interested, I have my latest tuning results at these >>>links: >>> >>>http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_x-1b.png >>> >>>http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_z-1b.png >> >>Much better! You should be able to add some "I" now to get rid of the >>steady state errors. >> >>Chris > > > I seem to recall putting in 1.0 for I and got an oscillation. Maybe I > should try some fractional settings. A little I, and fractional values are often needed, can help. Otherwise, you can turn up (or down) FF1 to bring the steady-state error down right to zero. Then, you can add just a tiny bit of FF2 (often something like 0.002) to bring the accel spikes down close to zero error, too. Some of these parameters are VERY sensitive. Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
On Sun, 2007-10-14 at 19:42 -0500, Chris Radek wrote: > On Sun, Oct 14, 2007 at 05:39:02PM -0700, Kirk Wallace wrote: > > In case anyone is interested, I have my latest tuning results at these > > links: > > > > http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_x-1b.png > > > > http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_z-1b.png > > Much better! You should be able to add some "I" now to get rid of the > steady state errors. > > Chris I seem to recall putting in 1.0 for I and got an oscillation. Maybe I should try some fractional settings. -- Kirk Wallace (California, USA http://www.wallacecompany.com/machine_shop/ Hardinge HNC lathe Bridgeport mill conversion pending Zubal lathe conversion pending) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
On Sun, Oct 14, 2007 at 05:39:02PM -0700, Kirk Wallace wrote: > In case anyone is interested, I have my latest tuning results at these > links: > > http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_x-1b.png > > http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_z-1b.png Much better! You should be able to add some "I" now to get rid of the steady state errors. Chris - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
[Emc-users] HNC Lathe Tuning
In case anyone is interested, I have my latest tuning results at these links: http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_x-1b.png http://www.wallacecompany.com/cnc_lathe/HNC/emc2/pid_z-1b.png -- Kirk Wallace (California, USA http://www.wallacecompany.com/machine_shop/ Hardinge HNC lathe Bridgeport mill conversion pending Zubal lathe conversion pending) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > On Fri, 2007-10-12 at 20:37 -0500, Jon Elson wrote: > ... snip > >>>So at 5k cpi on my lathe, I should be able to get similar results, I >>>hope. Thanks Jon. >>> >> >>Well, 5000 is a lot less than 128,000, and 4 times coarser than >>my 20,000 counts/inch. So, it would be normal to expect the >>best following error you could achieve may be worse. One >>encoder count is .0002" so you will never get better than that. >> >>Jon > > > Opps. It's really 50k cpi. I'm going to have to get a dog so I can blame > my mistakes on it. > Yes, 50 K will definitely work a lot better! > I have a plot for X here: > http://www.wallacecompany.com/cnc_lathe/HNC/emc2/p95i4d3ff1_1.png > > I started working on Z and totally missed it up. Hopefully, I'll be able > to fix it tomorrow. > Not too bad, but you might need more P. If you can't handle more P without oscillation, try adding or reducing D. If you can damp out the oscillation, then turn P up some more. When you get that as high as you can while still well stable, then turn up FF1 until the error at constant velocity is reduced to a small value. Now, you will have some errors during the accel and decel ramps, so increase FF2 until those are not much worse than the steady-speed error. You should be able to get the error on this routine down to maybe 100 uinch. Looks like you are rocking back and forth 1/2 inch in one second, including the accel-decel. Your velocity is peaking at 35000 counts a second, with 50K counts/inch, that would be 0.7 IPS or 42 IPM. Maybe I'll have to do one of these tomorrow and show you how good you can get it. If the axes are similar (motors, amps, leadscrews, etc.) then the numbers that work on one axis can be used as a starting point for the next. Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
On Fri, 2007-10-12 at 20:37 -0500, Jon Elson wrote: ... snip > > > > So at 5k cpi on my lathe, I should be able to get similar results, I > > hope. Thanks Jon. > > > Well, 5000 is a lot less than 128,000, and 4 times coarser than > my 20,000 counts/inch. So, it would be normal to expect the > best following error you could achieve may be worse. One > encoder count is .0002" so you will never get better than that. > > Jon Opps. It's really 50k cpi. I'm going to have to get a dog so I can blame my mistakes on it. I have a plot for X here: http://www.wallacecompany.com/cnc_lathe/HNC/emc2/p95i4d3ff1_1.png I started working on Z and totally missed it up. Hopefully, I'll be able to fix it tomorrow. -- Kirk Wallace (Hardinge HNC lathe, California, USA http://www.wallacecompany.com/machine_shop/ ) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > I just discovered this page: > > http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?PWM_Servo_Amplifiers > > This should be a great help. I wrote a .ngc file with "g1f20x.4, x0,%" > in it. I setup Halscope, the same as the above link, on one screen with > EMC and EMC's Calibrator in another. I make a change in Calibrator, jump > to Halscope and invoke single trigger then jump to EMC and run the > program and finally, I jump back to Halscope to review the data. I am > hoping to get some screen shots on my website. > I display the ppmc.0.encoder.x.delta, which is instantaneous velocity, and set the scope trigger on that, with an appropriate trigger level. This gets halscope to trigger at the beginning of each move. I set trigger mode to "normal", so it doesn't erase the result until I have finished looking at it. I just use manual jogs for a stimulus, and change the jog speed to see what effect different speeds have. > Is there a way to save the captured data to a file and then load the > file to halscope for viewing later? Viewing the real data would be > better than a screen shot. > The latest version of Halscope has just had a data dump mode added, I haven't had a chance to try it yet. I don't think halscope can "replay" that dump, it will just be a table of numbers. This would be good for numerical analysis of the servo data, like making Bode plots or Fourier transforms. > I was also thinking that it would be good to have EMC loop an axis move > and have halscope update on the trigger, as it already does, and then be > able to tweak the PID settings as EMC loops. > There is a loop function in EMC2's G-code interpreter, and the calibration window is "live". > On Fri, 2007-10-12 at 12:01 -0500, Jon Elson wrote: > >>Kirk, >> >>Just to add a data point on my minimill system, it has 128000 >>encoder counts per inch. I can get the following error down to >>about 200 uInch peak, up to 50 IPM or more. But, it takes some >>effort to tune it to that level. >> >>On my Bridgeport, I have 2 counts per inch on X and Y, and I >>usually get down to .0005" following error on that machine. At >>standstill, the error is usually +/- .0001 or less. >> >>Jon > > > So at 5k cpi on my lathe, I should be able to get similar results, I > hope. Thanks Jon. > Well, 5000 is a lot less than 128,000, and 4 times coarser than my 20,000 counts/inch. So, it would be normal to expect the best following error you could achieve may be worse. One encoder count is .0002" so you will never get better than that. Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > > I was also thinking that it would be good to have EMC loop an axis move > and have halscope update on the trigger, as it already does, and then be > able to tweak the PID settings as EMC loops. When I do PID tuning I usually skip EMC completely. I just set up a simple single axis HAL configuration using "siggen" as the signal source. Run the siggen square wave output through a "limit3" block and you get a classic trapezoidal velocity profile of whatever length and repetition rate you want. Then I use "setp" commands from the halcmd command line to tune. Once I have values I like, "show param pid" displays them, I jot them down, and enter them into the ini file or wherever they are needed. Regards, John Kasunich - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
I just discovered this page: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?PWM_Servo_Amplifiers This should be a great help. I wrote a .ngc file with "g1f20x.4, x0,%" in it. I setup Halscope, the same as the above link, on one screen with EMC and EMC's Calibrator in another. I make a change in Calibrator, jump to Halscope and invoke single trigger then jump to EMC and run the program and finally, I jump back to Halscope to review the data. I am hoping to get some screen shots on my website. Is there a way to save the captured data to a file and then load the file to halscope for viewing later? Viewing the real data would be better than a screen shot. I was also thinking that it would be good to have EMC loop an axis move and have halscope update on the trigger, as it already does, and then be able to tweak the PID settings as EMC loops. On Fri, 2007-10-12 at 12:01 -0500, Jon Elson wrote: > Kirk, > > Just to add a data point on my minimill system, it has 128000 > encoder counts per inch. I can get the following error down to > about 200 uInch peak, up to 50 IPM or more. But, it takes some > effort to tune it to that level. > > On my Bridgeport, I have 2 counts per inch on X and Y, and I > usually get down to .0005" following error on that machine. At > standstill, the error is usually +/- .0001 or less. > > Jon So at 5k cpi on my lathe, I should be able to get similar results, I hope. Thanks Jon. -- Kirk Wallace (Hardinge HNC lathe, California, USA http://www.wallacecompany.com/machine_shop/ ) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk, Just to add a data point on my minimill system, it has 128000 encoder counts per inch. I can get the following error down to about 200 uInch peak, up to 50 IPM or more. But, it takes some effort to tune it to that level. On my Bridgeport, I have 2 counts per inch on X and Y, and I usually get down to .0005" following error on that machine. At standstill, the error is usually +/- .0001 or less. Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > On Thu, 2007-10-11 at 20:53 -0500, Jon Elson wrote: > >>Kirk Wallace wrote: >> >>>What is the status of PID_MAX_VEL and PWM_OUTPUT_SCALE? My understanding >>>is that they were created to fix persistence issues. I am using EMC >>>2.1.7 so should I still use them? >>> >> >>Arrghhh! I don't actually know. PID_MAX_VEL is a standard part >>of the modern ini file, and should still be used. It is to >>allow the servo algorithm to have a little extra headroom for >>acceleration. > > > So PID_MAX_VEL is not unique to the UPC? No, any version that uses the servo mode of operation will have it. Only setups that use stepgen don't use PID, I think. > >> >>You can just change these lines in hnc_motion-3a.hal >> >>and remove the PWM_ from the 3 lines above. Then, remove the >>now redundant lines with PWM_OUTPUT_SCALE from your ini file. > > > For some reason that I can't recall, the above did not work for me right > away, so I put PWM_OUTPUT_SCALE back the way it was, set it to -1, > zeroed out the pid/ff settings and started over. Now I have P set to ~50 > and FF1 set to .25 and everything else set to 0. My FERROR is now .0050 > and MIN_FERROR is .0013. Typically, I am getting .0005" difference > between the commanded position and the actual position, which is better > than a couple of days ago, but I am hoping to do better. I just need to > put in more effort. > Hmm, I don't know why that didn't work. (I see I still have it this way on my downloadable configs directories on my web page, too!) But, I have definitely done it on my development systems. Anyway, to get the error down, you want to have the P gain as high as possible. You need to add a small amount of D to keep it stable as you raise P. You might have P set somewhere between 80 and 250, depending on all the other factors (motor, supply voltage, friction, etc.) As the encoder resolution rises, then the linear dimension of each encoder count is smaller. So, with a high res encoder, the P term and all others needs to be larger. Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
On Thu, 2007-10-11 at 20:53 -0500, Jon Elson wrote: > Kirk Wallace wrote: > > What is the status of PID_MAX_VEL and PWM_OUTPUT_SCALE? My understanding > > is that they were created to fix persistence issues. I am using EMC > > 2.1.7 so should I still use them? > > > Arrghhh! I don't actually know. PID_MAX_VEL is a standard part > of the modern ini file, and should still be used. It is to > allow the servo algorithm to have a little extra headroom for > acceleration. So PID_MAX_VEL is not unique to the UPC? > PWM_OUTPUT_SCALE is an anachronism, as you say above. The best > way to find out if it is still active is to do the following, > after doing a cd to the configs directory you are using: > > grep PWM_OUTPUT_SCALE *.hal > > This will scan all the hal files for use of this parameter. If > it doesn't show up at all, then it is not being used. > > Ahh, I have done it for you : > # set output scaling from ini file > # note that these are using PWM_OUTPUT_SCALE - they should > # use OUTPUT_SCALE, but right now EMC2 re-writes that to > # 1 on shutdown for some reason. Once that is fixed, this > # should be changed > setp ppmc.0.pwm.00.scale [AXIS_0]PWM_OUTPUT_SCALE > setp ppmc.0.pwm.01.scale [AXIS_1]PWM_OUTPUT_SCALE > setp ppmc.0.pwm.02.scale [AXIS_2]PWM_OUTPUT_SCALE > > You can just change these lines in hnc_motion-3a.hal > > and remove the PWM_ from the 3 lines above. Then, remove the > now redundant lines with PWM_OUTPUT_SCALE from your ini file. For some reason that I can't recall, the above did not work for me right away, so I put PWM_OUTPUT_SCALE back the way it was, set it to -1, zeroed out the pid/ff settings and started over. Now I have P set to ~50 and FF1 set to .25 and everything else set to 0. My FERROR is now .0050 and MIN_FERROR is .0013. Typically, I am getting .0005" difference between the commanded position and the actual position, which is better than a couple of days ago, but I am hoping to do better. I just need to put in more effort. > But, then, I think you will find that if you turn OUTPUT_SCALE > back down to -1, you will get MORE voltage out of the servo amp. > OUTPUT_SCALE (which is just an ini parameter for the hal > parameter ppmc.0.pwm.xx.scale is a DIVIDER, not a multiplier ... snip > > There's really no reason to mess with output scale, other than > making the sign correct to close the loop, as P does the same > thing (although it IS a multiplier). > > Jon -- Kirk Wallace (Hardinge HNC lathe, California, USA http://www.wallacecompany.com/machine_shop/ ) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] HNC Lathe Tuning
Kirk Wallace wrote: > What is the status of PID_MAX_VEL and PWM_OUTPUT_SCALE? My understanding > is that they were created to fix persistence issues. I am using EMC > 2.1.7 so should I still use them? > Arrghhh! I don't actually know. PID_MAX_VEL is a standard part of the modern ini file, and should still be used. It is to allow the servo algorithm to have a little extra headroom for acceleration. PWM_OUTPUT_SCALE is an anachronism, as you say above. The best way to find out if it is still active is to do the following, after doing a cd to the configs directory you are using: grep PWM_OUTPUT_SCALE *.hal This will scan all the hal files for use of this parameter. If it doesn't show up at all, then it is not being used. Ahh, I have done it for you : # set output scaling from ini file # note that these are using PWM_OUTPUT_SCALE - they should # use OUTPUT_SCALE, but right now EMC2 re-writes that to # 1 on shutdown for some reason. Once that is fixed, this # should be changed setp ppmc.0.pwm.00.scale [AXIS_0]PWM_OUTPUT_SCALE setp ppmc.0.pwm.01.scale [AXIS_1]PWM_OUTPUT_SCALE setp ppmc.0.pwm.02.scale [AXIS_2]PWM_OUTPUT_SCALE You can just change these lines in hnc_motion-3a.hal and remove the PWM_ from the 3 lines above. Then, remove the now redundant lines with PWM_OUTPUT_SCALE from your ini file. But, then, I think you will find that if you turn OUTPUT_SCALE back down to -1, you will get MORE voltage out of the servo amp. OUTPUT_SCALE (which is just an ini parameter for the hal parameter ppmc.0.pwm.xx.scale is a DIVIDER, not a multiplier From the file .../src/hal/drivers/ppmc.c, in the routine static void write_pwmgens(slot_data_t *slot) is the code : /* calculate desired duty cycle */ dc = *(pg->value) / pg->scale; value is the commanded velocity from the PID calculation, and obviously it is divided there by the scale parameter. So, a SMALLER number will increase output. You were compensating for this division by turning P up much higher. >>From a previous thread and a desire to optimize my .ini file settings, I > decided to monitor the DC output from my UPC/PWM amp setup to my brushed > motors while doing some tuning. I ramped up my jog velocity until I got > following errors and noted that the voltage was 22 Volts. Considering > that my motor supply is 100 Volts, I concluded that I needed to increase > the output scale from 1 to whatever was needed to get the motor voltage > close to 100 Volts. (I thought that I read somewhere that OUTPUT_SCALE > should only be +1 or -1?) There's really no reason to mess with output scale, other than making the sign correct to close the loop, as P does the same thing (although it IS a multiplier). Jon - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
[Emc-users] HNC Lathe Tuning
What is the status of PID_MAX_VEL and PWM_OUTPUT_SCALE? My understanding is that they were created to fix persistence issues. I am using EMC 2.1.7 so should I still use them? >From a previous thread and a desire to optimize my .ini file settings, I decided to monitor the DC output from my UPC/PWM amp setup to my brushed motors while doing some tuning. I ramped up my jog velocity until I got following errors and noted that the voltage was 22 Volts. Considering that my motor supply is 100 Volts, I concluded that I needed to increase the output scale from 1 to whatever was needed to get the motor voltage close to 100 Volts. (I thought that I read somewhere that OUTPUT_SCALE should only be +1 or -1?) I got to a PWM_OUTPUT_SCALE of 35 and 32 Volts before I started getting following errors again. I am a little surprised that wasn't able to raise the scale to a voltage output close to 100 and the increased voltage did not seem to help reduce my FERROR and MIN_FERROR numbers. Does anyone have a guess at why I should get following errors as I increase output voltage. Another strange thing is that when I first tuned the lathe, I would get resonance at a P value above 250, I now have it at 700 and still have not reach resonance. Below is may current X axis setup. (full document here: http://www.wallacecompany.com/cnc_lathe/HNC/emc2/configs ) # First axis [AXIS_0] TYPE = LINEAR UNITS = 0.03937007874016 HOME = 0.000 MAX_VELOCITY = 2.0 MAX_ACCELERATION = 3.0 PID_MAX_VEL = 100 BACKLASH = 0.000 CYCLE_TIME =0.001000 INPUT_SCALE = 5 OUTPUT_SCALE = -1 PWM_OUTPUT_SCALE = -30 MIN_LIMIT = -12.0 MAX_LIMIT = 2.0 FERROR =0.0002 MIN_FERROR =0.0025 HOME_OFFSET = 0.0 HOME_SEARCH_VEL = 0.8 HOME_LATCH_VEL =-0.06 HOME_USE_INDEX =YES HOME_IGNORE_LIMITS =NO DEADBAND = 1e-06 P = 700 I = 0 D = 0 BIAS = 0 FF0 = 0 FF1 = 7.5 FF2 = 0 -- Kirk Wallace (Hardinge HNC lathe, California, USA http://www.wallacecompany.com/machine_shop/ ) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users