Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-28 Thread Karlsson Wang
Sounds good.


On Fri, 27 Mar 2015 20:54:31 +
andy pugh bodge...@gmail.com wrote:

 On 27 March 2015 at 20:44, Karlsson  Wang
 nicklas.karls...@karlssonwang.se wrote:
  It is possible, i can't see it anymore.
 
 As I understand it, the encoder edges are timestamped by either the
 system clock or a high-res counter in the FPGA, so at any point the
 calculation is based on the total number of edges seen and the actual
 time that the first edge seen and the last edge seen were registered.
 This allows a much more accurate calculation than just number of
 edges this servo cycle.
 
 The difference is especially marked when there are edges less often
 than once per servo thread
 
 -- 
 atp
 If you can't fix it, you don't own it.
 http://www.ifixit.com/Manifesto
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Peter C. Wallace
On Fri, 27 Mar 2015, Les Newell wrote:

 Date: Fri, 27 Mar 2015 16:04:37 +
 From: Les Newell les.new...@fastmail.co.uk
 Reply-To: Enhanced Machine Controller (EMC)
 emc-users@lists.sourceforge.net
 To: Enhanced Machine Controller (EMC) emc-users@lists.sourceforge.net
 Subject: Re: [Emc-users] Velocity closed loop + Position losed loop on an axis
 
 Hi Peter,

 That is a good way to estimate speed. I'm not sure how well it would
 have worked in my application because it may be many servo periods
 between counts.

 Les

Not sure about the other ones but the Mesa driver has a settable timeout for 
velocity estimation (settable in seconds) before giving up and setting the 
estimated velocity to 0. This has no specific relation to servo periods




 On 26/03/2015 20:23, Peter C. Wallace wrote:
 The LinuxCNC software encoder counter and at least the Mesa and Pico Systems
 hardware encoder counters have DeltaCounts/DeltaTime velocity estimation.

 This calculates the velocity based on the number of counts per servo period
 divided by the time between counts (time is measured with a high speed timer
 built into the encoder counter)

 You dont need a terribly fast timer because at higher speeds, you are not
 measuring the time between single counts but rather between the first and 
 last
 of many counts


 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users


Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
()_() signature to help him gain world domination.


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Les Newell
Nice. Unfortunately this particular job is cost sensitive so I'm 
currently doing everything in a PIC.

Les

On 27/03/2015 16:11, Peter C. Wallace wrote:
 Not sure about the other ones but the Mesa driver has a settable 
 timeout for velocity estimation (settable in seconds) before giving up 
 and setting the estimated velocity to 0. This has no specific relation 
 to servo periods


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Les Newell
Hi Peter,

That is a good way to estimate speed. I'm not sure how well it would 
have worked in my application because it may be many servo periods 
between counts.

Les

On 26/03/2015 20:23, Peter C. Wallace wrote:
 The LinuxCNC software encoder counter and at least the Mesa and Pico Systems
 hardware encoder counters have DeltaCounts/DeltaTime velocity estimation.

 This calculates the velocity based on the number of counts per servo period
 divided by the time between counts (time is measured with a high speed timer
 built into the encoder counter)

 You dont need a terribly fast timer because at higher speeds, you are not
 measuring the time between single counts but rather between the first and last
 of many counts


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Karlsson Wang
It is possible, i can't see it anymore.


On Thu, 26 Mar 2015 21:46:27 +
andy pugh bodge...@gmail.com wrote:

 On 26 March 2015 at 21:10, Karlsson  Wang
 nicklas.karls...@karlssonwang.se wrote:
  Quite many pulses need to be counted and servo thread is run quite often. 
  For eight bit resolution which is rather low 256 pulses must be counted in 
  the time delta there speed is measured.
 
 I think you are misunderstanding PCW's comment.
 
 -- 
 atp
 If you can't fix it, you don't own it.
 http://www.ifixit.com/Manifesto
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread andy pugh
On 27 March 2015 at 20:44, Karlsson  Wang
nicklas.karls...@karlssonwang.se wrote:
 It is possible, i can't see it anymore.

As I understand it, the encoder edges are timestamped by either the
system clock or a high-res counter in the FPGA, so at any point the
calculation is based on the total number of edges seen and the actual
time that the first edge seen and the last edge seen were registered.
This allows a much more accurate calculation than just number of
edges this servo cycle.

The difference is especially marked when there are edges less often
than once per servo thread

-- 
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Leonardo Marsaglia
2015-03-26 13:55 GMT-03:00 Jon Elson el...@pico-systems.com:

 I make some dumb PWM-controlled servo amps.  The PWM duty
 cycle is converted to voltage output, not a current (as in a
 torque-mode amp) or true velocity (there's no velocity or
 current feedback).  So, LinuxCNC's PID module is the only
 thing between the commanded position and the motor-encoder.
 This system is harder to tune, but it does work pretty
 well.  Velocity is extracted using the velocity estimation
 scheme used on many LinuxCNC encoders and fed to the
 optional velocity input of the PID  ( pid.0.feedback-deriv).


I just made a post on our improvements using VFDs and AC induction motors
as servos. Well tuning is a bit of a pain because but I'm pretty surprised
by the way they are behaving. I need to fine tune them, also I need to
learn a lot about how to tune them but in the next days I'm going to give
it a try to see how I can improve it.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Leonardo Marsaglia
2015-03-26 13:55 GMT-03:00 Jon Elson el...@pico-systems.com:

 No, I don't think we are talking exactly about the same
 thing. Common velocity servo amplifiers have an analog
 velocity error amp, which takes in a velocity command from
 the CNC control and a measured velocity, usually from a DC
 tachometer mounted on (or IN) the motor.  If there is not
 tachometer, then some controls, especially Fanuc, synthesize
 the tach signal using a chip such as the ST Micro L290
 (sadly, no longer available).  A few people who have big
 servo amplifiers like this have made LinuxCNC do the same as
 the Fanuc control, and it works.  Assuming a 1 KHz servo
 cycle, there is inevitably a 1 ms delay in providing the
 synthetic velocity output, but it seems to work fine.
 Probably these old velocity amps from the 1970s don't have a
 very high bandwidth, so it is OK.


I see. I think this is how the servo drives are working on our Mazak. They
are Meldas TRA-31A and TRA-41A if I remember correctly. They are taking the
velocity from the motors using tachos and the only thing they do is to
close the velocity loop. Then the CNC closes the position loop with the
resolvers mounted on the screws.

After we finish this machine the idea is to put hands on the Mazak to
upgrade the CNC to LinuxCNC because we need to improve it's capabilities
and also, everytime something on that lathe fails we're praying for the
solution to be easy. In case of a CPU fail that's going to be almost
impossible to solve taking the easy way, so LinuxCNC it's a much more
logical solution.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-27 Thread Jon Elson
On 03/27/2015 11:04 AM, Les Newell wrote:
 Hi Peter,

 That is a good way to estimate speed. I'm not sure how well it would
 have worked in my application because it may be many servo periods
 between counts.


That's the whole idea of the velocity estimation, it allows 
smooth velocity changes when the count rate is below or just 
faster than the servo period.  Without it, the velocity 
computed by subtracting last position from current position 
has huge jumps when each count comes in.

Jon

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Karlsson Wang
For stability without rattle inertia is low but for the hole gear box inertia 
is a low. I guess servo loop have to be tuned for the low inertia or a small 
load added to get rid of the rattle.

If there are enough bandwidth and computational power I can see so no reason to 
keep peridoicity of servo loop down. Theoretical upper limit then increasing 
make no point is in best twice the switching frequency. For a slow mechanical 
system there might however be very little to gain.


Nicklas Karlsson




On Wed, 25 Mar 2015 20:12:26 -0400
Gene Heskett ghesk...@wdtv.com wrote:

 On Wednesday 25 March 2015 19:02:16 Karlsson  Wang wrote:
  To get higher accuracy you need more accurate measurement, some extra
  resolution above the accuracy is also useful.
 
  For better dynamic perfomance it may make sense to close the inner
  loop if the inner loop is faster than the outer loop. If the electic
  response is much faster than the mechanical response then there is
  rather little to gain from faster control loop. If motor inductance is
  around 1mH, applied voltage is 48 volt and current is 10A then
  U=L*di/dt = dt = L*di/U = 1mH*10A/48V = 0.2ms = 200µs is the time to
  change motor torque from zero to maximum which put an upper limit on
  dynamic response, there is also a rotational speed dependent back emf
  reducing available voltage.
 
  If you do not like the math. Change servo loop peridicity adjust
  control loop and see if it make any real difference.
 
 
  Nicklas Karlsson
 
 If I can butt in here Leonardo, when I was setting up the spindle speed 
 servo in my toy lathe after switching from a non-linear and failure 
 prone driver to drive the 1hp treadmill motor my 7x12 now sports, to a 
 slightly modified version of the Pico Systems servo driver, and keeping 
 in mind I am using one of Peters 5i25 interfaces, which means I no 
 longer needed a base thread in the setup.  But the speed servo was 
 hunting badly enough to keep the back gears in the headstock rattling 
 pretty good when the servo thread was running at nominally 1 kilohertz.
 
 I had to reduce the P in the pid to the point it was essentially 
 worthless at sub 300 rev speeds.  So for SG, thinking the control was 
 too slow, I did a rockhopper diagram and re-arranged the hal file so 
 that I was doing a straight fall thru of the control path so it was not 
 wasting a period or more because it was out of order when the modules 
 were in the wrong order.  That helped but the amount of P seemed to be 
 limited yet, so the only other way to get a faster control loop was to 
 raise the servo thread speed. Nominally 2 kilohertz made an obvious 
 difference, and at 4 kilohertz, it was lots quieter.  So that is where 
 it has been running at for several months now.  P in the speed PID is 
 now high enough that I can peel off a pretty good sized string of blued 
 steel at 150 revs, or even a dimly glowing string at 500 revs, which 
 gives a more better finish.
 
 My $0.02.  Works well here, might not be worth the electron wiggle to 
 send it to someone else.  The phrase YMMV applies here.
 
 
 
 
  On Wed, 25 Mar 2015 14:45:42 -0300
 
  Leonardo Marsaglia leonardomarsagli...@gmail.com wrote:
   Hello to all!
  
   I just managed to turn the second motor of my machine (another AC
   motor with a Powerflex 40 drive) and works just fine for positioning
   the part. Tomorrow I'll be uploading some videos.
  
   Although I need to do some fine tuning on both the rotary and the
   linear axis I was thinking about a concept to improve the accuracy
   of the servo loops.
  
   As I have seen on many machines including the Mazak that we have
   here, the servo systems close the velocity loop within the servo
   drive, and then the CNC applies a voltage to control the velocity of
   the motor based on the PID of the position loop.
  
   So as I see it, it's like there is one pid nested inside the other,
   or sort of. Now the VFDs that I'm using can close the velocity loop
   but I would have to use a special module for that.
  
   My question is, based on your experience. Could this improve the
   accuracy of the joints? I guess this could be done within LinuxCNC
   without closing the loop on the VFDs.
  
   Thanks as always for your help!!
  
   --
   *Leonardo Marsaglia*.
   
  -- Dive into the World of Parallel Programming The Go
   Parallel Website, sponsored by Intel and developed in partnership
   with Slashdot Media, is your hub for all things parallel software
   development, from weekly thought leadership blogs to news, videos,
   case studies, tutorials and more. Take a look and join the
   conversation now. http://goparallel.sourceforge.net/
   ___
   Emc-users mailing list
   Emc-users@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/emc-users
 
  

Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Karlsson Wang
Do the math. Accuracy is bad at low speed and there is a lower limit on speed. 
Is number of pulses counted to give speed? Is time between pulses measured to 
give speed?



Nicklas Karlsson



On Wed, 25 Mar 2015 23:59:02 -0300
Leonardo Marsaglia leonardomarsagli...@gmail.com wrote:

 2015-03-25 23:17 GMT-03:00 Jon Elson el...@pico-systems.com:
 
  You should check this out :
 
  http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis
 
  There used to be a web page that described dual feedback on
  one of the big machines at Stuart Stevenson's MPM shop and
  had a bit of history of how they arranged to do that, but I
  can not find it now. They used a linear encoder for position
  feedback and a shaft encoder on the motor for velocity feedback.
 
  (Anybody know where the descriptive page with photos, etc.
  on that has gone to?)
 
 
 Hello Jon and thanks for the link I didn't remember about it.
 
 I guess my approach of using the same encoder mounted on the shaft of the
 motor isn't the best solution for speed and position feedback right?.
 
 As I told gene I was planning on using the same encoder for velocity and
 then position feedback but I don't know if this is a good option.
 
 
 -- 
 *Leonardo Marsaglia*.
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Jon Elson
On 03/26/2015 01:16 AM, Leonardo Marsaglia wrote:
 2015-03-26 1:06 GMT-03:00 Jon Elson el...@pico-systems.com:

 Do you mean to extract velocity from the encoder and then
 feed it out a DAC channel to
 a velocity servo amp?  This is what almost all FANUC
 controls do, and a few people are
 doing this with LinuxCNC.  I think Chris Radek is doing this
 on his machine, and John Kasunich and Chris
 Kelley at Tx/Rx Labs in Texas got this working on their
 PowerHawk mill.

 Well, If I understand you correctly, yes we're talking about the same.
 Extract the encoder velocity, feed the DAC through a PID to close the
 velocity loop and also close the position loop to move that axis. What I'm
 using here is not a servo drive as you know but the purpose is the same.
 I'm thinking about using the approach on the link you sended to me from the
 wiki but instead of using two feedback devices, use just one.
No, I don't think we are talking exactly about the same 
thing. Common velocity servo amplifiers have an analog 
velocity error amp, which takes in a velocity command from 
the CNC control and a measured velocity, usually from a DC 
tachometer mounted on (or IN) the motor.  If there is not 
tachometer, then some controls, especially Fanuc, synthesize 
the tach signal using a chip such as the ST Micro L290 
(sadly, no longer available).  A few people who have big 
servo amplifiers like this have made LinuxCNC do the same as 
the Fanuc control, and it works.  Assuming a 1 KHz servo 
cycle, there is inevitably a 1 ms delay in providing the 
synthetic velocity output, but it seems to work fine.  
Probably these old velocity amps from the 1970s don't have a 
very high bandwidth, so it is OK.
 I'm going to try it out tomorrow to see what happens, anyway as I said
 before.. LinuxCNC is working great so far without closing the velocity
 loop. What I'm doing so far is, closing the position loop and the DACs are
 feeding the VFDs without really closing the velocity loop, LinuxCNC is only
 asking to VFDs for a velocity but without knowing if the motor is reaching
 the speed at the moment LinuxCNC expects them to reach it. I guess this is
 why closing the loop both ways makes it more accurate. Anyway I don't
 expect them to be as delicate as a permanent magnet servo but I think they
 can be improved.
I make some dumb PWM-controlled servo amps.  The PWM duty 
cycle is converted to voltage output, not a current (as in a 
torque-mode amp) or true velocity (there's no velocity or 
current feedback).  So, LinuxCNC's PID module is the only 
thing between the commanded position and the motor-encoder.  
This system is harder to tune, but it does work pretty 
well.  Velocity is extracted using the velocity estimation 
scheme used on many LinuxCNC encoders and fed to the 
optional velocity input of the PID  ( pid.0.feedback-deriv).

Jon

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Les Newell
Recently I used an encoder for both velocity and position on a 
specialist application (not using LinuxCNC) and it worked very well. 
Velocity is calculated by measuring the time between successive encoder 
counts. This application uses a very coarse encoder (144 counts/rev) and 
it only runs at low speed (200RPM). I'm not sure how well that would 
translate into a LinuxCNC application. For higher resolution encoders at 
higher speeds you need a very fast timer.

Les


On 26/03/2015 02:59, Leonardo Marsaglia wrote:
 Hello Jon and thanks for the link I didn't remember about it. I guess 
 my approach of using the same encoder mounted on the shaft of the 
 motor isn't the best solution for speed and position feedback right?. 
 As I told gene I was planning on using the same encoder for velocity 
 and then position feedback but I don't know if this is a good option. 


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Peter C. Wallace
On Thu, 26 Mar 2015, Les Newell wrote:

 Date: Thu, 26 Mar 2015 14:00:10 +
 From: Les Newell les.new...@fastmail.co.uk
 Reply-To: Enhanced Machine Controller (EMC)
 emc-users@lists.sourceforge.net
 To: Enhanced Machine Controller (EMC) emc-users@lists.sourceforge.net
 Subject: Re: [Emc-users] Velocity closed loop + Position losed loop on an axis
 
 Recently I used an encoder for both velocity and position on a
 specialist application (not using LinuxCNC) and it worked very well.
 Velocity is calculated by measuring the time between successive encoder
 counts. This application uses a very coarse encoder (144 counts/rev) and
 it only runs at low speed (200RPM). I'm not sure how well that would
 translate into a LinuxCNC application. For higher resolution encoders at
 higher speeds you need a very fast timer.

 Les


The LinuxCNC software encoder counter and at least the Mesa and Pico Systems 
hardware encoder counters have DeltaCounts/DeltaTime velocity estimation.

This calculates the velocity based on the number of counts per servo period
divided by the time between counts (time is measured with a high speed timer
built into the encoder counter)

You dont need a terribly fast timer because at higher speeds, you are not 
measuring the time between single counts but rather between the first and last 
of many counts


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread andy pugh
On 26 March 2015 at 21:10, Karlsson  Wang
nicklas.karls...@karlssonwang.se wrote:
 Quite many pulses need to be counted and servo thread is run quite often. For 
 eight bit resolution which is rather low 256 pulses must be counted in the 
 time delta there speed is measured.

I think you are misunderstanding PCW's comment.

-- 
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Karlsson Wang
Quite many pulses need to be counted and servo thread is run quite often. For 
eight bit resolution which is rather low 256 pulses must be counted in the time 
delta there speed is measured.

Nicklas Karlsson




On Thu, 26 Mar 2015 13:23:29 -0700 (PDT)
Peter C. Wallace p...@mesanet.com wrote:

 On Thu, 26 Mar 2015, Les Newell wrote:
 
  Date: Thu, 26 Mar 2015 14:00:10 +
  From: Les Newell les.new...@fastmail.co.uk
  Reply-To: Enhanced Machine Controller (EMC)
  emc-users@lists.sourceforge.net
  To: Enhanced Machine Controller (EMC) emc-users@lists.sourceforge.net
  Subject: Re: [Emc-users] Velocity closed loop + Position losed loop on an 
  axis
  
  Recently I used an encoder for both velocity and position on a
  specialist application (not using LinuxCNC) and it worked very well.
  Velocity is calculated by measuring the time between successive encoder
  counts. This application uses a very coarse encoder (144 counts/rev) and
  it only runs at low speed (200RPM). I'm not sure how well that would
  translate into a LinuxCNC application. For higher resolution encoders at
  higher speeds you need a very fast timer.
 
  Les
 
 
 The LinuxCNC software encoder counter and at least the Mesa and Pico Systems 
 hardware encoder counters have DeltaCounts/DeltaTime velocity estimation.
 
 This calculates the velocity based on the number of counts per servo period
 divided by the time between counts (time is measured with a high speed timer
 built into the encoder counter)
 
 You dont need a terribly fast timer because at higher speeds, you are not 
 measuring the time between single counts but rather between the first and 
 last 
 of many counts
 
 
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Leonardo Marsaglia
2015-03-26 1:06 GMT-03:00 Jon Elson el...@pico-systems.com:

 Do you mean to extract velocity from the encoder and then
 feed it out a DAC channel to
 a velocity servo amp?  This is what almost all FANUC
 controls do, and a few people are
 doing this with LinuxCNC.  I think Chris Radek is doing this
 on his machine, and John Kasunich and Chris
 Kelley at Tx/Rx Labs in Texas got this working on their
 PowerHawk mill.


Well, If I understand you correctly, yes we're talking about the same.
Extract the encoder velocity, feed the DAC through a PID to close the
velocity loop and also close the position loop to move that axis. What I'm
using here is not a servo drive as you know but the purpose is the same.
I'm thinking about using the approach on the link you sended to me from the
wiki but instead of using two feedback devices, use just one.

I'm going to try it out tomorrow to see what happens, anyway as I said
before.. LinuxCNC is working great so far without closing the velocity
loop. What I'm doing so far is, closing the position loop and the DACs are
feeding the VFDs without really closing the velocity loop, LinuxCNC is only
asking to VFDs for a velocity but without knowing if the motor is reaching
the speed at the moment LinuxCNC expects them to reach it. I guess this is
why closing the loop both ways makes it more accurate. Anyway I don't
expect them to be as delicate as a permanent magnet servo but I think they
can be improved.




-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread Gene Heskett
On Wednesday 25 March 2015 22:48:36 Leonardo Marsaglia wrote:
 2015-03-25 21:12 GMT-03:00 Gene Heskett ghesk...@wdtv.com:
  If I can butt in here Leonardo, when I was setting up the spindle
  speed servo in my toy lathe after switching from a non-linear and
  failure prone driver to drive the 1hp treadmill motor my 7x12 now
  sports, to a slightly modified version of the Pico Systems servo
  driver, and keeping in mind I am using one of Peters 5i25
  interfaces, which means I no longer needed a base thread in the
  setup.  But the speed servo was hunting badly enough to keep the
  back gears in the headstock rattling pretty good when the servo
  thread was running at nominally 1 kilohertz.
 
  I had to reduce the P in the pid to the point it was essentially
  worthless at sub 300 rev speeds.  So for SG, thinking the control
  was too slow, I did a rockhopper diagram and re-arranged the hal
  file so that I was doing a straight fall thru of the control path so
  it was not wasting a period or more because it was out of order when
  the modules were in the wrong order.  That helped but the amount of
  P seemed to be limited yet, so the only other way to get a faster
  control loop was to raise the servo thread speed. Nominally 2
  kilohertz made an obvious difference, and at 4 kilohertz, it was
  lots quieter.  So that is where it has been running at for several
  months now.  P in the speed PID is now high enough that I can peel
  off a pretty good sized string of blued steel at 150 revs, or even a
  dimly glowing string at 500 revs, which gives a more better
  finish.

 Hello Gene!

 I always like to here from your experiences.

 From what I've been doing I got really good results but I don't recall
 trying to raise the speed of the servo thread to make any difference
 so I'll be trying tomorrow.

 The idea that was spinning in my head is if it will make any
 difference (if possible) first to close a speed loop and then feed
 with that the position loop all using the same encoders for the two
 feedbacks.

 Here's an example picture:

 http://s23.postimg.org/6xyj2q0zf/reductor.jpg

 That's the rotary axis, the picture is before I mounted the encoder
 but you can see how it works. I know It would be the best to have
 another encoder on the main shaft to really know the exact position
 but, since this is not thar critical and the worm and gear have almost
 none backlash we decided this setup would be ok.

 What I'm doing here is to sense directly on the shaft of the motor
 (this would give me a really accurate reading of the speed). But It
 would be great if this same encoder could feed also the position loop
 in LinuxCNC.

That does look as if the tut for using two PID's in a previous message 
might be helpful.

I' make the comment that the tension on the belt is pretty important to 
reduce tha backlsash.  I have it tight enough on the mills home made z 
drive to potentially damage the motors bearings. I'd estimate the 
current tension is well north of 75 lbs. The screw is solidly anchored 
into the top of the heads sled casting, and I am turning the doubled nut 
assembly, squeezed between two angular ball bearings with the timing 
belt. This gets me down to around 1.5 thou of backlash on a 10 tpi nook 
acme screw when the double nuts are dragging. If there is any deflection 
of the belt in the middle of the pulley to pulley span, it will 
translate directly into some pretty horrible backlash readings.  If I 
just push the motor until its snug, the measured backlash will easily 
top 10 thou.

Another thought on that setup might be to add a smooth drum above the 
driven pulley, to wind up a tape measure spring on, put considerable 
tension on the far end of the tape, and attach a linear scale to the 
tape.  I'd think it would not be too difficult to get .1 degree accuracy 
out of that once it was scaled properly with the usual circumference 
math.  Same idea as was used on old floppy drives back in the 80's to 
step the heads.  Then you wouldn't need to care about worm to bull lash 
as that would just be something the servo would self correct for.  But 
you'd still want it as low as possible to prevent to table from being 
driven by the cutting force IF there was cutting force.

From your description of what its being used for that doesn't sound as if 
there would be much if any of that sort of force involved as its 
basically non-contact. 

Sometimes its amazing where you find amplified slop.

Thanks for the flowers. :)

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from 

Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-26 Thread John Kasunich


On Wed, Mar 25, 2015, at 10:17 PM, Jon Elson wrote:
 On 03/25/2015 12:45 PM, Leonardo Marsaglia wrote:
  As I have seen on many machines including the Mazak that we have here, the
  servo systems close the velocity loop within the servo drive, and then the
  CNC applies a voltage to control the velocity of the motor based on the PID
  of the position loop.
 
 
 You should check this out :
 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis
 
 There used to be a web page that described dual feedback on 
 one of the big machines at Stuart Stevenson's MPM shop and 
 had a bit of history of how they arranged to do that, but I 
 can not find it now. They used a linear encoder for position 
 feedback and a shaft encoder on the motor for velocity feedback.
 
 (Anybody know where the descriptive page with photos, etc. 
 on that has gone to?)
 
 Jon

That was an entry on my blog.  When I updated the server to Wheezy, I got
the basic server running, but was pressed for time and never set up the
blogging software.  The files are still on the computer, just not being served
to the world.  I should fix that, just need a round tuit.


-- 
  John Kasunich
  jmkasun...@fastmail.fm

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
Hello to all!

I just managed to turn the second motor of my machine (another AC motor
with a Powerflex 40 drive) and works just fine for positioning the part.
Tomorrow I'll be uploading some videos.

Although I need to do some fine tuning on both the rotary and the linear
axis I was thinking about a concept to improve the accuracy of the servo
loops.

As I have seen on many machines including the Mazak that we have here, the
servo systems close the velocity loop within the servo drive, and then the
CNC applies a voltage to control the velocity of the motor based on the PID
of the position loop.

So as I see it, it's like there is one pid nested inside the other, or sort
of. Now the VFDs that I'm using can close the velocity loop but I would
have to use a special module for that.

My question is, based on your experience. Could this improve the accuracy
of the joints? I guess this could be done within LinuxCNC without closing
the loop on the VFDs.

Thanks as always for your help!!

-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread alex chiosso
Hi Leonardo.
If you want to perform a closed loop position system as you said you need
the inner speed closed loop.
I do believe that can be quite difficult to perform both closed loops
within LCNC with the expected accuracy.
The VFD that you are using is a sensor less vector control type (that is
why you have to close the speed loop outside the VFD).
This kind of VFD are not the right product to run a servo system (as you
already know) also because you should drive an asynchronous induction motor
that is not usually suited for that porpouse.
I'm not a LCNC guru  but at least I've always used a vector VFD with
encoder feedback tied from the motor to the VFD with the encoder simulation
feedback connected to the axis module .

Alex


On Wed, Mar 25, 2015 at 6:45 PM, Leonardo Marsaglia 
leonardomarsagli...@gmail.com wrote:

 Hello to all!

 I just managed to turn the second motor of my machine (another AC motor
 with a Powerflex 40 drive) and works just fine for positioning the part.
 Tomorrow I'll be uploading some videos.

 Although I need to do some fine tuning on both the rotary and the linear
 axis I was thinking about a concept to improve the accuracy of the servo
 loops.

 As I have seen on many machines including the Mazak that we have here, the
 servo systems close the velocity loop within the servo drive, and then the
 CNC applies a voltage to control the velocity of the motor based on the PID
 of the position loop.

 So as I see it, it's like there is one pid nested inside the other, or sort
 of. Now the VFDs that I'm using can close the velocity loop but I would
 have to use a special module for that.

 My question is, based on your experience. Could this improve the accuracy
 of the joints? I guess this could be done within LinuxCNC without closing
 the loop on the VFDs.

 Thanks as always for your help!!

 --
 *Leonardo Marsaglia*.

 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread alex chiosso
How are you managing the positioning right now?
Are you using limit switches or incremental encoder or something else?
Il giorno 25/mar/2015 19:45, Leonardo Marsaglia 
leonardomarsagli...@gmail.com ha scritto:

 2015-03-25 15:07 GMT-03:00 alex chiosso achio...@gmail.com:

  Hi Leonardo.
  If you want to perform a closed loop position system as you said you need
  the inner speed closed loop.
  I do believe that can be quite difficult to perform both closed loops
  within LCNC with the expected accuracy.
  The VFD that you are using is a sensor less vector control type (that is
  why you have to close the speed loop outside the VFD).
  This kind of VFD are not the right product to run a servo system (as
 you
  already know) also because you should drive an asynchronous induction
 motor
  that is not usually suited for that porpouse.
  I'm not a LCNC guru  but at least I've always used a vector VFD with
  encoder feedback tied from the motor to the VFD with the encoder
 simulation
  feedback connected to the axis module .
 

 Hello Alex and thanks for the answer.

 Well, I know this is not the best solution to drive a servo system, but
 since this is not a really accurate machine, because I only need to
 position a coil for induction heating, I can live with that. Also now It's
 working pretty well considering these limitations.

 Anyway I was investigating this because If I can manage to get better
 results with this system I would love to achieve them.






 --
 *Leonardo Marsaglia*.

 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 16:46 GMT-03:00 alex chiosso achio...@gmail.com:

 How are you managing the positioning right now?
 Are you using limit switches or incremental encoder or something else?


Now I'm using incremental encoders on both axis and I'm finishing the setup
with LinuxCNC. For the linear axis the maximum error is like 0.1 mm wich is
really good considering the setup and also considering the accuracy that I
need.

The other one I'm going to make some tuning tomorrow and I'll be telling
you. Also tomorrow I'll be uploading some videos of the machine running.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 15:07 GMT-03:00 alex chiosso achio...@gmail.com:

 Hi Leonardo.
 If you want to perform a closed loop position system as you said you need
 the inner speed closed loop.
 I do believe that can be quite difficult to perform both closed loops
 within LCNC with the expected accuracy.
 The VFD that you are using is a sensor less vector control type (that is
 why you have to close the speed loop outside the VFD).
 This kind of VFD are not the right product to run a servo system (as you
 already know) also because you should drive an asynchronous induction motor
 that is not usually suited for that porpouse.
 I'm not a LCNC guru  but at least I've always used a vector VFD with
 encoder feedback tied from the motor to the VFD with the encoder simulation
 feedback connected to the axis module .


Hello Alex and thanks for the answer.

Well, I know this is not the best solution to drive a servo system, but
since this is not a really accurate machine, because I only need to
position a coil for induction heating, I can live with that. Also now It's
working pretty well considering these limitations.

Anyway I was investigating this because If I can manage to get better
results with this system I would love to achieve them.






-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread alex chiosso
Looks really good.
I've understood that you're running the axis with position open loop
control.
Am I wrong?
Il giorno 25/mar/2015 20:52, Leonardo Marsaglia 
leonardomarsagli...@gmail.com ha scritto:

 2015-03-25 16:46 GMT-03:00 alex chiosso achio...@gmail.com:

  How are you managing the positioning right now?
  Are you using limit switches or incremental encoder or something else?
 

 Now I'm using incremental encoders on both axis and I'm finishing the setup
 with LinuxCNC. For the linear axis the maximum error is like 0.1 mm wich is
 really good considering the setup and also considering the accuracy that I
 need.

 The other one I'm going to make some tuning tomorrow and I'll be telling
 you. Also tomorrow I'll be uploading some videos of the machine running.


 --
 *Leonardo Marsaglia*.

 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Karlsson Wang
To get higher accuracy you need more accurate measurement, some extra 
resolution above the accuracy is also useful.

For better dynamic perfomance it may make sense to close the inner loop if the 
inner loop is faster than the outer loop. If the electic response is much 
faster than the mechanical response then there is rather little to gain from 
faster control loop. If motor inductance is around 1mH, applied voltage is 48 
volt and current is 10A then U=L*di/dt = dt = L*di/U = 1mH*10A/48V = 0.2ms = 
200µs is the time to change motor torque from zero to maximum which put an 
upper limit on dynamic response, there is also a rotational speed dependent 
back emf reducing available voltage.

If you do not like the math. Change servo loop peridicity adjust control loop 
and see if it make any real difference.


Nicklas Karlsson





On Wed, 25 Mar 2015 14:45:42 -0300
Leonardo Marsaglia leonardomarsagli...@gmail.com wrote:

 Hello to all!
 
 I just managed to turn the second motor of my machine (another AC motor
 with a Powerflex 40 drive) and works just fine for positioning the part.
 Tomorrow I'll be uploading some videos.
 
 Although I need to do some fine tuning on both the rotary and the linear
 axis I was thinking about a concept to improve the accuracy of the servo
 loops.
 
 As I have seen on many machines including the Mazak that we have here, the
 servo systems close the velocity loop within the servo drive, and then the
 CNC applies a voltage to control the velocity of the motor based on the PID
 of the position loop.
 
 So as I see it, it's like there is one pid nested inside the other, or sort
 of. Now the VFDs that I'm using can close the velocity loop but I would
 have to use a special module for that.
 
 My question is, based on your experience. Could this improve the accuracy
 of the joints? I guess this could be done within LinuxCNC without closing
 the loop on the VFDs.
 
 Thanks as always for your help!!
 
 -- 
 *Leonardo Marsaglia*.
 --
 Dive into the World of Parallel Programming The Go Parallel Website, sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for all
 things parallel software development, from weekly thought leadership blogs to
 news, videos, case studies, tutorials and more. Take a look and join the 
 conversation now. http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Gene Heskett
On Wednesday 25 March 2015 19:02:16 Karlsson  Wang wrote:
 To get higher accuracy you need more accurate measurement, some extra
 resolution above the accuracy is also useful.

 For better dynamic perfomance it may make sense to close the inner
 loop if the inner loop is faster than the outer loop. If the electic
 response is much faster than the mechanical response then there is
 rather little to gain from faster control loop. If motor inductance is
 around 1mH, applied voltage is 48 volt and current is 10A then
 U=L*di/dt = dt = L*di/U = 1mH*10A/48V = 0.2ms = 200µs is the time to
 change motor torque from zero to maximum which put an upper limit on
 dynamic response, there is also a rotational speed dependent back emf
 reducing available voltage.

 If you do not like the math. Change servo loop peridicity adjust
 control loop and see if it make any real difference.


 Nicklas Karlsson

If I can butt in here Leonardo, when I was setting up the spindle speed 
servo in my toy lathe after switching from a non-linear and failure 
prone driver to drive the 1hp treadmill motor my 7x12 now sports, to a 
slightly modified version of the Pico Systems servo driver, and keeping 
in mind I am using one of Peters 5i25 interfaces, which means I no 
longer needed a base thread in the setup.  But the speed servo was 
hunting badly enough to keep the back gears in the headstock rattling 
pretty good when the servo thread was running at nominally 1 kilohertz.

I had to reduce the P in the pid to the point it was essentially 
worthless at sub 300 rev speeds.  So for SG, thinking the control was 
too slow, I did a rockhopper diagram and re-arranged the hal file so 
that I was doing a straight fall thru of the control path so it was not 
wasting a period or more because it was out of order when the modules 
were in the wrong order.  That helped but the amount of P seemed to be 
limited yet, so the only other way to get a faster control loop was to 
raise the servo thread speed. Nominally 2 kilohertz made an obvious 
difference, and at 4 kilohertz, it was lots quieter.  So that is where 
it has been running at for several months now.  P in the speed PID is 
now high enough that I can peel off a pretty good sized string of blued 
steel at 150 revs, or even a dimly glowing string at 500 revs, which 
gives a more better finish.

My $0.02.  Works well here, might not be worth the electron wiggle to 
send it to someone else.  The phrase YMMV applies here.




 On Wed, 25 Mar 2015 14:45:42 -0300

 Leonardo Marsaglia leonardomarsagli...@gmail.com wrote:
  Hello to all!
 
  I just managed to turn the second motor of my machine (another AC
  motor with a Powerflex 40 drive) and works just fine for positioning
  the part. Tomorrow I'll be uploading some videos.
 
  Although I need to do some fine tuning on both the rotary and the
  linear axis I was thinking about a concept to improve the accuracy
  of the servo loops.
 
  As I have seen on many machines including the Mazak that we have
  here, the servo systems close the velocity loop within the servo
  drive, and then the CNC applies a voltage to control the velocity of
  the motor based on the PID of the position loop.
 
  So as I see it, it's like there is one pid nested inside the other,
  or sort of. Now the VFDs that I'm using can close the velocity loop
  but I would have to use a special module for that.
 
  My question is, based on your experience. Could this improve the
  accuracy of the joints? I guess this could be done within LinuxCNC
  without closing the loop on the VFDs.
 
  Thanks as always for your help!!
 
  --
  *Leonardo Marsaglia*.
  
 -- Dive into the World of Parallel Programming The Go
  Parallel Website, sponsored by Intel and developed in partnership
  with Slashdot Media, is your hub for all things parallel software
  development, from weekly thought leadership blogs to news, videos,
  case studies, tutorials and more. Take a look and join the
  conversation now. http://goparallel.sourceforge.net/
  ___
  Emc-users mailing list
  Emc-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/emc-users

 --
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored by Intel and developed in partnership with Slashdot
 Media, is your hub for all things parallel software development, from
 weekly thought leadership blogs to news, videos, case studies,
 tutorials and more. Take a look and join the conversation now.
 http://goparallel.sourceforge.net/
 ___
 Emc-users mailing list
 Emc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/emc-users

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in 

Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Jon Elson
On 03/25/2015 12:45 PM, Leonardo Marsaglia wrote:
 As I have seen on many machines including the Mazak that we have here, the
 servo systems close the velocity loop within the servo drive, and then the
 CNC applies a voltage to control the velocity of the motor based on the PID
 of the position loop.


You should check this out :
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

There used to be a web page that described dual feedback on 
one of the big machines at Stuart Stevenson's MPM shop and 
had a bit of history of how they arranged to do that, but I 
can not find it now. They used a linear encoder for position 
feedback and a shaft encoder on the motor for velocity feedback.

(Anybody know where the descriptive page with photos, etc. 
on that has gone to?)

Jon

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 16:56 GMT-03:00 alex chiosso achio...@gmail.com:

 Looks really good.
 I've understood that you're running the axis with position open loop
 control.
 Am I wrong?


No open but closed loop on LinuxCNC. The only thing I'm looking after is to
closed both velocity and position loop like a real servo would do.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Gene Heskett


On Wednesday 25 March 2015 20:22:14 andy pugh wrote:
 On 26 March 2015 at 00:12, Gene Heskett ghesk...@wdtv.com wrote:
  I had to reduce the P in the pid to the point it was essentially
  worthless at sub 300 rev speeds.

 I am not sure that P is appropriate for a speed controller.
 The point is that P = 0 when the speed is correct. But you don't want
 0 PID output when the speed is correct, or the speed will stop being
 correct.
 So, a speed loop might want to be mainly FF0 and I.

You AIR, said that when I was doing the setup, but the regulation was 
very poor. Let me go see what its actually using now.

#
# Spindle
#
[SPINDLE_9]
P = 75.000
I = 1.000
D = 0.000
FF0 = 86.00
FF1 = 2.000
FF2 = 0.000
BIAS = 0.
FBIAS = 38
RBIAS = -38
ACCEL   = 5.7
LIMIT3_ACCEL= 1600.0
LOWGEAR = 2.125
DEADBAND = 0.000
# diff between s_max_outut and s_scale sets max pwm duty, make max_out 
98% of s_scale
LIMIT3_S_MAX_OUTPUT =   2048
# But it needs clipped in both directions, so...
LIMIT3_S_MIN_OUTPUT =   -2048
ENCODER_SCALE   =   200.0
PWMGEN_S_SCALE  =   2100
PWMGEN_S_FREQ   =   25000
# near_tol is now in %, 12.5 IOW
NEAR_TOL=   0.5
NEAR_SCALE  =   1.075
ENCODER_SAMPLE  =   50

And its running decently.  The weight of the chuck makes a pretty good 
low pass filter.

Cheers, Gene Heskett
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 20:02 GMT-03:00 Karlsson  Wang nicklas.karls...@karlssonwang.se
:

 To get higher accuracy you need more accurate measurement, some extra
 resolution above the accuracy is also useful.

 For better dynamic perfomance it may make sense to close the inner loop if
 the inner loop is faster than the outer loop. If the electic response is
 much faster than the mechanical response then there is rather little to
 gain from faster control loop. If motor inductance is around 1mH, applied
 voltage is 48 volt and current is 10A then U=L*di/dt = dt = L*di/U =
 1mH*10A/48V = 0.2ms = 200µs is the time to change motor torque from zero to
 maximum which put an upper limit on dynamic response, there is also a
 rotational speed dependent back emf reducing available voltage.

 If you do not like the math. Change servo loop peridicity adjust control
 loop and see if it make any real difference.


Thanks for the data, and I really like the math, it's just that in cases
like these you always want to put the machine to work as accurate as it
coul be to make the job and then understand all the theory involved in the
process (wich I really like  to dig in a lot).

Playing with the control loop it has been the best option because with that
I achieved a 0.1 mm following error on the linear axis. I'm still managing
to tune up the loop for the rotary axis (now I have 1.5 degrees of error
more or less) but it's working ok for the job so far.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread andy pugh
On 26 March 2015 at 00:12, Gene Heskett ghesk...@wdtv.com wrote:
 I had to reduce the P in the pid to the point it was essentially
 worthless at sub 300 rev speeds.

I am not sure that P is appropriate for a speed controller.
The point is that P = 0 when the speed is correct. But you don't want
0 PID output when the speed is correct, or the speed will stop being
correct.
So, a speed loop might want to be mainly FF0 and I.


-- 
atp
If you can't fix it, you don't own it.
http://www.ifixit.com/Manifesto

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 23:17 GMT-03:00 Jon Elson el...@pico-systems.com:

 You should check this out :

 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

 There used to be a web page that described dual feedback on
 one of the big machines at Stuart Stevenson's MPM shop and
 had a bit of history of how they arranged to do that, but I
 can not find it now. They used a linear encoder for position
 feedback and a shaft encoder on the motor for velocity feedback.

 (Anybody know where the descriptive page with photos, etc.
 on that has gone to?)


Hello Jon and thanks for the link I didn't remember about it.

I guess my approach of using the same encoder mounted on the shaft of the
motor isn't the best solution for speed and position feedback right?.

As I told gene I was planning on using the same encoder for velocity and
then position feedback but I don't know if this is a good option.


-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
Same thinking on the bottom of the link you sended to me jon haha :).

It seems redundant to measure the same axis twice, with two encoders. But
often that gives significantly better results than using a single encoder.
Whether it is two different kinds of sensor -- gyro, accelerometer, GPS [1]
http://quadcopter.wordpress.com/2010/02/08/taking-a-break/. Or two
identical sensors in two different locations, one with accuracy but bad
latency, the other with good (low) latency but bad accuracy: Bob Pease,
What's All This P-I-D Stuff, Anyhow?[2]
http://electronicdesign.com/content.aspx?topic=what-s-all-this-p-i-d-stuff-anyhow-6131

2015-03-25 23:59 GMT-03:00 Leonardo Marsaglia leonardomarsagli...@gmail.com
:


 2015-03-25 23:17 GMT-03:00 Jon Elson el...@pico-systems.com:

 You should check this out :

 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

 There used to be a web page that described dual feedback on
 one of the big machines at Stuart Stevenson's MPM shop and
 had a bit of history of how they arranged to do that, but I
 can not find it now. They used a linear encoder for position
 feedback and a shaft encoder on the motor for velocity feedback.

 (Anybody know where the descriptive page with photos, etc.
 on that has gone to?)


 Hello Jon and thanks for the link I didn't remember about it.

 I guess my approach of using the same encoder mounted on the shaft of the
 motor isn't the best solution for speed and position feedback right?.

 As I told gene I was planning on using the same encoder for velocity and
 then position feedback but I don't know if this is a good option.


 --
 *Leonardo Marsaglia*.




-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Jon Elson
On 03/25/2015 09:59 PM, Leonardo Marsaglia wrote:
 2015-03-25 23:17 GMT-03:00 Jon Elson el...@pico-systems.com:

 You should check this out :

 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

 There used to be a web page that described dual feedback on
 one of the big machines at Stuart Stevenson's MPM shop and
 had a bit of history of how they arranged to do that, but I
 can not find it now. They used a linear encoder for position
 feedback and a shaft encoder on the motor for velocity feedback.

 (Anybody know where the descriptive page with photos, etc.
 on that has gone to?)

 Hello Jon and thanks for the link I didn't remember about it.

 I guess my approach of using the same encoder mounted on the shaft of the
 motor isn't the best solution for speed and position feedback right?.
No, nothing wrong with it, if you have sufficient encoder 
counters.
 As I told gene I was planning on using the same encoder for velocity and
 then position feedback but I don't know if this is a good option.
Do you mean to extract velocity from the encoder and then 
feed it out a DAC channel to
a velocity servo amp?  This is what almost all FANUC 
controls do, and a few people are
doing this with LinuxCNC.  I think Chris Radek is doing this 
on his machine, and John Kasunich and Chris
Kelley at Tx/Rx Labs in Texas got this working on their 
PowerHawk mill.

Jon


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread Leonardo Marsaglia
2015-03-25 21:12 GMT-03:00 Gene Heskett ghesk...@wdtv.com:

 If I can butt in here Leonardo, when I was setting up the spindle speed
 servo in my toy lathe after switching from a non-linear and failure
 prone driver to drive the 1hp treadmill motor my 7x12 now sports, to a
 slightly modified version of the Pico Systems servo driver, and keeping
 in mind I am using one of Peters 5i25 interfaces, which means I no
 longer needed a base thread in the setup.  But the speed servo was
 hunting badly enough to keep the back gears in the headstock rattling
 pretty good when the servo thread was running at nominally 1 kilohertz.

 I had to reduce the P in the pid to the point it was essentially
 worthless at sub 300 rev speeds.  So for SG, thinking the control was
 too slow, I did a rockhopper diagram and re-arranged the hal file so
 that I was doing a straight fall thru of the control path so it was not
 wasting a period or more because it was out of order when the modules
 were in the wrong order.  That helped but the amount of P seemed to be
 limited yet, so the only other way to get a faster control loop was to
 raise the servo thread speed. Nominally 2 kilohertz made an obvious
 difference, and at 4 kilohertz, it was lots quieter.  So that is where
 it has been running at for several months now.  P in the speed PID is
 now high enough that I can peel off a pretty good sized string of blued
 steel at 150 revs, or even a dimly glowing string at 500 revs, which
 gives a more better finish.


Hello Gene!

I always like to here from your experiences.

From what I've been doing I got really good results but I don't recall
trying to raise the speed of the servo thread to make any difference so
I'll be trying tomorrow.

The idea that was spinning in my head is if it will make any difference (if
possible) first to close a speed loop and then feed with that the position
loop all using the same encoders for the two feedbacks.

Here's an example picture:

http://s23.postimg.org/6xyj2q0zf/reductor.jpg

That's the rotary axis, the picture is before I mounted the encoder but you
can see how it works. I know It would be the best to have another encoder
on the main shaft to really know the exact position but, since this is not
thar critical and the worm and gear have almost none backlash we decided
this setup would be ok.

What I'm doing here is to sense directly on the shaft of the motor (this
would give me a really accurate reading of the speed). But It would be
great if this same encoder could feed also the position loop in LinuxCNC.






-- 
*Leonardo Marsaglia*.
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Velocity closed loop + Position losed loop on an axis

2015-03-25 Thread dave
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

On 03/25/2015 08:01 PM, Leonardo Marsaglia wrote:
 Same thinking on the bottom of the link you sended to me jon haha :).

 It seems redundant to measure the same axis twice, with two encoders. But
 often that gives significantly better results than using a single encoder.
 Whether it is two different kinds of sensor -- gyro, accelerometer, GPS [1]
 http://quadcopter.wordpress.com/2010/02/08/taking-a-break/. Or two
 identical sensors in two different locations, one with accuracy but bad
 latency, the other with good (low) latency but bad accuracy: Bob Pease,
 What's All This P-I-D Stuff, Anyhow?[2]
 http://electronicdesign.com/content.aspx?topic=what-s-all-this-p-i-d-stuff-anyhow-6131

 2015-03-25 23:59 GMT-03:00 Leonardo Marsaglia leonardomarsagli...@gmail.com
 :
 2015-03-25 23:17 GMT-03:00 Jon Elson el...@pico-systems.com:

 You should check this out :

 http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Combining_Two_Feedback_Devices_On_One_Axis

 There used to be a web page that described dual feedback on
 one of the big machines at Stuart Stevenson's MPM shop and
 had a bit of history of how they arranged to do that, but I
 can not find it now. They used a linear encoder for position
 feedback and a shaft encoder on the motor for velocity feedback.

 (Anybody know where the descriptive page with photos, etc.
 on that has gone to?)

 Hello Jon and thanks for the link I didn't remember about it.

 I guess my approach of using the same encoder mounted on the shaft of the
 motor isn't the best solution for speed and position feedback right?.

 As I told gene I was planning on using the same encoder for velocity and
 then position feedback but I don't know if this is a good option.


 --
 *Leonardo Marsaglia*.





--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users