News:

  • April 18, 2024, 02:13:03 PM

Login with username, password and session length

Author Topic: Following Another Encoder  (Read 19230 times)

Mike Nash

  • Hero Member
  • *****
  • Posts: 636
Following Another Encoder
« on: October 17, 2014, 12:18:07 PM »
I am looking for a way to have a servo follow another servo, but with a dynamic ratio adjust AND the ability to have the following servo reverse direction. It is a traverse for a winder. The ratio allows adjusting how the material lays on the roll and the reversing is for left to right. Currently the traverse is via a reversing clutch fed by a mechanical ratio mechanism from the winder motor. The winding motor is running in torque mode so speed varies quite a bit.

I would like to do this with a Do-more, CTRIO2 and Cmore. I have looked at the CTDYNPOS command but am unclear as to whether it would allow following realtime like this, along with reversal of direction.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #1 on: October 17, 2014, 12:36:49 PM »
You'd stand a better chance with CTAXDYNP. The target position can be updated on the fly, including reversal, and the module will get you there...or keep trying while you continually move his cheese.

I worry a little bit about jitter when you use a position target instead of velocity. I've done follower type behaviors before where I generated a SIN wave in math and had a stepper follow it. It works, but it wasn't as smooth as I wanted. The next logical step would have been to use a PID and control velocity (CTAXDYNV) instead of position, but I never followed through with that. The looser you can tolerate the uptake being, the better chance you can make it smooth.

I'm sure it can be done, but with caveats.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 636
Re: Following Another Encoder
« Reply #2 on: October 17, 2014, 07:04:00 PM »
How does the position target get loaded with CTAXDYNP? Is it only updated during the PLC scan as opposed to getting a master encoder value directly from the quadrature input? I have to admit that finding something I saw a second time is a little difficult in Help.

CTRUNPOS looks like it can follow a quad encoder directly with Trapezoid Plus or Trapezoid with Limits, but... I need to be able to adjust the scale on the fly and I don't think that can happen.

A little deeper look. If I set the CTAXDYNP Target Position to a Quad Input that should also follow. Pointing to a scaled CTRIO2 input should also work. But neither of these is going to allow changing the ratio on the fly, much less reversing.

So I am going to need to massage the encoder input in ladder and set the target position each scan, correct?

The servo we are looking to use allows smoothing the pulse train input without losing pulse counts and this being a traverse that should be acceptable. The servo is also not going to lose track of the rotor due to any jitter like a stepper might.

If this would work, it might be feasible to add the servo traverse with the single H2-CTRIO2 we will already be using anyway.

With all that said, I don't want or need any surprises. I wish I had a CTRIO2 on hand to experiment with. :( Then again, I don't have a servo to hand either. ::)

When are we going to see the CTRIO/2 simulator module? ;D ;D

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #3 on: October 18, 2014, 12:18:13 PM »
How does the position target get loaded with CTAXDYNP? Is it only updated during the PLC scan as opposed to getting a master encoder value directly from the quadrature input? I have to admit that finding something I saw a second time is a little difficult in Help.

Specify a variable for the target position in CTAXDYNP, enable the CTAXDYNP instruction, set the .GotoPosition bit in the associated structure from code. With CYAXDYNP, you can feed it a new position every other scan or so.


CTRUNPOS looks like it can follow a quad encoder directly with Trapezoid Plus or Trapezoid with Limits, but... I need to be able to adjust the scale on the fly and I don't think that can happen.

A little deeper look. If I set the CTAXDYNP Target Position to a Quad Input that should also follow. Pointing to a scaled CTRIO2 input should also work. But neither of these is going to allow changing the ratio on the fly, much less reversing.

The profiles that have encoder inputs are not followers in the sense that you are wanting, they are simply using the encoder as the position instead of the accumulated stepper pulse count, and the specified move is performed in encoder units instead of stepper units. The stepper is still the driving element, and the scale factor there is the ratio between encoder and the stepper.

In your case, you would be creating your own linkage between the two different axis mathematically, therefore the scale ratio between the two is up to the math that you choose.

In dynamic position mode, the axis reverses automatically when you specify a position behind the current position. There is nothing for you to do.


So I am going to need to massage the encoder input in ladder and set the target position each scan, correct?

The servo we are looking to use allows smoothing the pulse train input without losing pulse counts and this being a traverse that should be acceptable. The servo is also not going to lose track of the rotor due to any jitter like a stepper might.

Precisely. The question is just what is the best way to do that. When you specify a target position, the module is going to constantly accel/decel as it sees fit. This is the jitter I was referring to. If the slaved side is far enough behind that effect will be mitigated to a great degree, and if the servo has some filtering that will help too. An alternative would be to control the slaved servo with velocity control and use PID. I'm reasonably certain that could work, depending on how much slop you can handle between the master and slave, but that would require a bit more math and/or tuning.


If this would work, it might be feasible to add the servo traverse with the single H2-CTRIO2 we will already be using anyway.

With all that said, I don't want or need any surprises. I wish I had a CTRIO2 on hand to experiment with. :( Then again, I don't have a servo to hand either. ::)

And that is my only concern. I *think* it could be made to work, but that depends on a large number of variables that I don't have answers for. We'd like to add a follower mode to a future product, just aren't quite there yet.

When are we going to see the CTRIO/2 simulator module? ;D ;D

That'd certainly be nice, and you're not the first to ask. Right this moment we are peddling the bike as fast as we can on the development of the new Do-more platform...
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 636
Re: Following Another Encoder
« Reply #4 on: October 18, 2014, 01:45:43 PM »
Thanks BobO. I am really thinking this could work just fine for this app. The existing traverse system is on its last legs and it would be good to be able to change it over. I don't think it is all that critical as to precise positioning, but it does need to follow the winder wherever it leads.

I could always PID it if it proved necessary.

Keep up the good work!

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #5 on: October 18, 2014, 02:55:39 PM »
I might throw a PID routine in for chuckles and see how tight it is. Might be easier than I think, and once tuned, I'm pretty sure it would do a great job.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #6 on: October 18, 2014, 04:26:12 PM »
Done. Wasn't hard. Depending on aggressiveness of the tuning, it tracks quite close, but the stepper sounds like a theremin. More relaxed it doesn't sound quite so warbled, but doesn't track as closely. With filtering in the servo and a reasonably stable frequency, I'm sure it would work great. Oh yeah...I was tracking a SIN wave with a period of about 15 seconds, so my frequency was never stable. I would expect yours to be far more so.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #7 on: October 18, 2014, 04:28:39 PM »
Results...
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

omprodesign

  • Newbie
  • *
  • Posts: 2
Re: Following Another Encoder
« Reply #8 on: November 10, 2014, 04:21:19 PM »
Bob, Mike...very interesting thread. I need to do something very similar. I have an encoder (E1) and wheel in contact with a process material. The material is a continuous strip. The material is threaded through the first stage of the machine. The material is driven by a dc servo at a continuous velocity say 40 ft/min. E1 is a 600ppi encoder.
The second stage of the machine is an indexing head (IH). It consists of a punch and a shear. The punch and shear move together on linear rails driven by an AC servo drive and motor. Motor has built in encoder with 2500 line count (10k ppr). The IH must accelerate and match velocity of the process material long enough to punch, shear or both, decelerate reverse to home or reverse far enough to match the next register position of E1 (0, 600, 2400, 4200,...etc.).

Mike, how did your project work out.
Bob, have you done anything like this with the H2-DM1E, H2-CTRIO2, D2-08CDR (to provide dc servo speed reference)?

 

Mike Nash

  • Hero Member
  • *****
  • Posts: 636
Re: Following Another Encoder
« Reply #9 on: November 10, 2014, 04:41:44 PM »
The traverse got the thumbs down for the time being. I have been programming on (translating really) the rest of program today as a matter of fact.

I never thought I would miss having BCD and double registers, etc., but this would have been an easier translation into a D2-260 since it was coming from an old Omron. OTOH, I did get to create my own data types (HR, DM and IR) so it was easier to type it in without having to have a map. I'm not really fond of having to use the colon for the bits (HR200:1 for HR 200.01), but oh well.

I still have to get the conversion from the grody Omron Hi Speed Counter nailed down. Hi Speed Counter cards have historically been a cryptic royal pain for some reason I shall probably never know.

Good luck with that flying punch/shear - never one of my favorites.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3558
  • Darth Ladder
Re: Following Another Encoder
« Reply #10 on: November 10, 2014, 05:44:32 PM »
I know how you feel about changing delimiters once they're ingrained.   In Logix 5K, I still try to separate the bit with a PLC/SLC style slash once in a while, even though the CLX has been around for 15 years!
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3558
  • Darth Ladder
Re: Following Another Encoder
« Reply #11 on: November 10, 2014, 05:56:02 PM »
In Do-Mores case,  I'm sure it's the price we pay for being able to enter FP contacts without an "R" like in DL.  I have no idea what AB's excuse for losing the slash is, though.   They changed a bunch of stuff from the PLC &  SLC that seemed unnecessary.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #12 on: November 10, 2014, 10:38:29 PM »
I never thought I would miss having BCD and double registers, etc.

There are BCD conversions and double registers in Do-more. What specifically are you missing?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 5984
  • Yes Pinky, Do-more will control the world!
Re: Following Another Encoder
« Reply #13 on: November 10, 2014, 10:44:30 PM »
Bob, have you done anything like this with the H2-DM1E, H2-CTRIO2, D2-08CDR (to provide dc servo speed reference)?

Me personally? No. I've made, serviced, and supported PLC products, but have never really used them. Crazy, huh?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 636
Re: Following Another Encoder
« Reply #14 on: November 10, 2014, 10:52:11 PM »
I never thought I would miss having BCD and double registers, etc.

There are BCD conversions and double registers in Do-more. What specifically are you missing?

I thought about it (for about 2 minutes) but it's not the same really as the math is BCD also. And they were playing games with using only the Most Significant Word and stuff. I did have to do some hoop-jumping with some of it, but I'll convert the counter stuff anyway so it's not a big deal. It's really, really hard to remember to type MATH instead of MUL or SUB, etc. Working with the Accumulator got to be second nature after enough of it. I sure do like having negative numbers though. But there again, they can sometimes cause problems too when the old PLC didn't have them.