EMC+closed loop?


Page 1 of 3 123 LastLast
Results 1 to 20 of 43

Thread: EMC+closed loop?

  1. #1
    Registered
    Join Date
    Apr 2007
    Location
    Slovenia
    Posts
    11
    Downloads
    0
    Uploads
    0

    Default EMC+closed loop?

    Hi,guys!

    Does EMC has got closed loops?
    Can i make closed loops with stepper motors?

    EMC+C10-bidirectional breakout board+step drivers+step motors with encoders

    Similar Threads:


  2. #2
    Registered
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    95
    Downloads
    0
    Uploads
    0

    Default

    I am no expert with EMC2 and am just starting out myself but it looks like that is what it was designed to do. Your problem will be interfacing. I think it was designed to use a servo control board to act as a buffer for the drives. You are using steppers and there is no buffer in the drives so I don't know if your computer can keep up with live encoder updating to drive in closed loop. You will need a stand alone card to control the motors that does the updating for you, dedicated. I may be wrong....anyone???????



  3. #3
    Member
    Join Date
    Jun 2003
    Location
    Boalsburg PA
    Posts
    866
    Downloads
    0
    Uploads
    0

    Default

    there is actually a theoretical problem using step/direction with encoders which has nothing to do with EMC. I ran into this problem years ago with a totally different stepper based system. It came with encoders, but they weren't used. I called the company that made the system and asked them how to make it closed loop with the encoders and they told me it wasn't going to work and go open loop, so I did. I just read the position from the encoders, but they aren't in the control.

    Most people find that a properly set up open loop stepper system works fine. There was a configuration in the EMC1 that would do closed loop steppers, and I really doubt anyone uses it. EMC2 is flexible that you probably could set it up.



  4. #4
    Member
    Join Date
    Feb 2007
    Location
    USA
    Posts
    592
    Downloads
    0
    Uploads
    0

    Default closed loop steppers

    Use a Pico systems USC - it generates its own step/dir output pulses and is not limited by paraport speed.

    It can also read encoders on steppers.

    http://pico-systems.com/univstep.html



  5. #5
    Registered
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default

    What do you mean by closed loop with steppers? reading off a shaft encoder is pointless unless it is to determine a step error and issue a fault (how the fault is handled is another matter) On the other hand if you have axis encoders and use them to close the loop which is what I call closed loop, steppers can be used, if the stepper has not missed a step and the axis position does not equal the desired position then take corrective action. It can be quite tricky as the acceleration ramp of the stepper needs to be incorporated into the desired position.

    Also you really need a quadrature decoder board to take this load off the system, axis position encoders can have very high pulse rates, best handled by hardware.



  6. #6
    Registered
    Join Date
    Aug 2007
    Location
    USA
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default

    HelicalCut,

    Sounds like you have a working understanding of the issues around closed loop servo systems. Do have all the hardware worked out for interfacing with the linear encoders? I don't quite understand why anyone would put up with the accumulated ball screw errors when a DRO style scale is a possibility. Perhaps the unpredictable travel is an issue. A dead reckoning is made for the travel, the ramp up and ramp down takes place and you are left somewhere in the general vicinity of your intended destination. If that is too far, the metal is already gone if this event was a cut so no taking it back. The software/hardware will have to be smart enough to finish the travel somewhere towards the end of the move in order linear position readings to mean something.

    What have you done to make all this work out?

    Thanks,
    John Mc



  7. #7
    Registered
    Join Date
    Jan 2006
    Location
    USA
    Posts
    58
    Downloads
    0
    Uploads
    0

    Default

    EMC2 can read quadrature encoders in software. Overall performance depends on how fast the computer is, how many lines the encoder has, and how fast you're spinning the motor.

    For example, a 256-line encoder produces 1,024 quadrature transitions per revolution. If you're spinning this motor at 1,000 rpm, that's about 17 revolutions per second, or about 17,000 quadrature transitions per second. You need to sample at more than twice that frequency to capture the input waveform properly, call it 35 KHz. So the encoder reader thread needs a period of 28 microseconds or faster to do its job. (If your motor is connected to a .200" pitch lead screw, that's 5 revolutions/inch, so 1,000 rpm is 200 inches/minute or 3 inches per second...)

    You can use the realtime latency checker to see what kind of realtime latency your computer is capable of. That time is slightly shorter than the shortest possible sampling period.

    Here's the general formula:
    • Let L be the number on lines on your encoder.
    • Let R be the maximum number of revolutions/minute.
    • Then F, the sampling frequency in Hz, needs to be at least 2 * (4 * L) * (R / 60) or (0.1333 * L * R)


    Alternatively, if you've determined how fast you can run your encoder-reader thread, you can solve for the max supported rpm using the formula R = (7.5 * F / L)


    That's my understanding, at least.



  8. #8
    Registered
    Join Date
    Aug 2007
    Location
    USA
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default interrupts

    I was suggesting using the linear scale of the DRO variety rather than doing shaft encoding.

    I was hoping that resolution could be improved by using table position encoder rather than a shaft encoder and thereby allow the use of looser tolerances on the ball screws.

    Are there systems out there that use such a method?

    By the way, I am new to CNC but not new to science. Fact is, this stuff is pretty simple in nature but lacking experience, I have to fumble around to find out what other people are doing to implement systems.

    So far I have the feeling that servos with very accurate ball screws with an encoder on the ball screw shaft is good, provided you have a really good ball screw and bearing. Steppers are burdened with resolution issues but that depends on the stepper and the screw pitch.

    No sense in getting too worked up over a few tenths if you don't need to cut super tight parts but my interest in what works best is more of an exercise in specsmanship and curiosity.



  9. #9
    Gold Member
    Join Date
    Mar 2003
    Location
    United States
    Posts
    2839
    Downloads
    0
    Uploads
    0

    Default

    I wasted 2 years trying to run a step motor PID closed-loop with only the encoder and step / direction available before concluding it's not possible. Arriving at that conclusion also suggested a different approach that does in fact work.

    Mariss



  10. #10
    Registered
    Join Date
    Jan 2006
    Location
    USA
    Posts
    58
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ironchops View Post
    I was suggesting using the linear scale of the DRO variety rather than doing shaft encoding.

    I was hoping that resolution could be improved by using table position encoder rather than a shaft encoder and thereby allow the use of looser tolerances on the ball screws.

    Are there systems out there that use such a method?
    I'm a noob at this too, but I think most closed-loop motors controllers get their feedback from the drive axle (ie an encoder on the lead screw) rather than from the driven object (the table or the quill, on a mill). When I first started thinking about CNC mills I also imagined getting the feedback from the table, but some study of the state of the art has indicated that this is not the way things are usually done.

    Proper control of the table position is extremely difficult if there is backlash in the drive train, or other loose tolerances in the positioning hardware (ie loose gibs). Backlash is often dependent on where in its travel the axis is, and of course it changes over time, so it's difficult to compensate for accurately. CNC machines are engineered to minimize positional slop, and the less positional slop there is the less incentive there is to get the feedback from the table rather than the leadscrew.

    That's my understanding.



  11. #11
    Registered
    Join Date
    Jan 2007
    Location
    MI. USA
    Posts
    210
    Downloads
    0
    Uploads
    0

    Default

    Using encoders with steppers on a machine tool is worthless. Lets say you try to close the loop with and encoder. Once there is an error what do you do? If you try to pump more steps into a running motor that is losing counts it will just stall and sing at you. If you wait till the end of the move and add extra steps you've already cut the part wrong. Say you've programmed a 45 degree line and lost some steps in X. Now you've got a 50 degree line with a straight correction move at the end.
    Steppers are made to be used as open loop devices. Unless of course you drive them like a brushless servo which is what I believe Mariss is working on.

    On the subject of using linear scales yes this can be done with servo motors but its very tricky and usually works worse than using the encoders on the motor. The problem here is related to backlash, stiction, mechanical response speed, and abbe errors. The errors add up to a phase shift in the control loop that make the loop unstable. You try to correct for the error and nothing happens so you add more correction and so on. Eventually you remove the backlash and suddenly you have too much correction. So you correct in the opposite direction and now you find yourself in oscillation.
    To make the thing run you end up "softening" the servo loop so much that your running error is much larger than with a conventional system. Your ending position will be right on but you'll have larger errors while cutting. It's important to remember that a servo system is always in error when moving, it is the error that make them move. Thats why servos typically have higher resolutions than stepper systems Normally you design a servo for at least 5 to 10 counts to your desired running resolution.

    Not to say it can't be done and this system works quite well in point to point machines that don't care about errors while moving (machine vision measuring machines for example). Some very, very high end machine tools will use laser interferometers as a linear scale for feed back. But you need a deep understanding of control theory and servo systems to make it work.
    Galil has a tutorial on their web site about this, using the "dual loop" feature of their controls to accomplish this task. I've set this up a number of times but have always ended up going back to the conventional method using just an encoder on the motor.

    I would never consider trying to read a high resolution encoder in software. If you stop right on a line you may get very high frequency up/down counts as the encoder settles and the software will miss counts. I've never seen a software system that doesn't lose counts and the circuitry for hardware quadrature decoding is so simple.
    Bob

    You can always spot the pioneers -- They're the ones with the arrows in their backs.


  12. #12
    Member
    Join Date
    Feb 2007
    Location
    USA
    Posts
    592
    Downloads
    0
    Uploads
    0

    Arrow Linier scales?

    I once saw a FADAL with glass scales fitted in ADDITION to the normal axis encoders.

    It could call a macro that would do a series of moves to compare the stored screw pitch error map to what was being reported NOW, and updated a temporary pitch error map which corrected for thermal expansion issues at that moment.

    The glass scales were never read while in actual motion.



  13. #13
    Registered
    Join Date
    Oct 2005
    Location
    USA
    Posts
    12
    Downloads
    0
    Uploads
    0

    Default

    while the previous posts are all quite correct, they leave out some important points that should help clear up some misconceptions around this issue. i'm going to elaborate on unterhaus' "theoretical issue" around the use of step/dir signalling to run a motor in closed loop.

    (skip this paragraph if you know how PID works)
    when a servo motor is commanded to go to a certain position, nothing would happen if it weren't for the PID controller. let's say we are at 0 and want to move to 1 inch. first the motion planner commands "1" and the motor is still. The difference between commanded and actual position (following error) is 1 inch. This is multiplied by the P value, (which was set to say 500 by the machine builder) and then output through a digital-to-analog converter, which usually has somewhere around 10 bits of resolution. This high-resolution signal is amplified and converted into high current to actually put torque on the motor. Now the motor picks up speed and it's cruising along at a good rate. We're at 0.5" now and still have 0.5" to go. P is still adding 250 whatsits to our torque command but we want to slow down before we overshoot the 1" mark - the torque command should be negative! This is where the D term comes in - it slows down the motor by reversing the torque command when we are going too fast. If P and D aren't both set properly, the motor will be sluggish or will oscillate wildly and overshoot the endpoint. Even if P and D are set right, the torque command must faithfully represent their wishes to the motor amplifier, or you get the same problems.

    Now, stepper motors by comparison have a very simple control scheme - if you aren't there yet, take another step. While a microstepping drive can have a position resolution approaching that of a low end servo, its control resolution is still far inferior. Let's say you had a 10x microstepping stepper (2000 steps/rev) with a 250 line encoder (1000 counts/rev) and you are behind by one encoder count, or two steps. The driver's options are: take one step, take two steps, take three steps, etc. If you take one step, you advance the counter one position in the stepper drive, which changes the currents in the coils a little bit, and gives a tiny amount of torque to the motor, which would be enough to move the motor to the desired position eventually, but it won't get there as fast as the motor is capable of doing. If you take two steps it advances the balance-point a little more, and you get a little more torque. Now as soon as you try to take three steps the balance point ends up overshooting the goal point, so you have to take a whole lot of steps backwards all of a sudden once you want to start slowing down. Essentially what you have is a two-bit torque command with a lot of delay built in. This delay is what really hurts the concept.

    It takes a certain amount of time to send those step signals. If you're using cheap (free) parallel port hardware with a maximum step rate of, say 50KHz, (a generous value, and ignoring jitter, latency, and other nasties) then taking 3 steps forward will take 60 microseconds, and taking 6 steps backwards will take another 120 microseconds. We're starting to get into the range of frequencies where our not-so-rapidly changing magnetic fields will actually move the motor backwards and forwards, so there is a limit here in how far you can advance or retard the balance point in order to get more or less torque. This makes for a sluggish control that also tends to overshoot. And we still haven't gotten to the main problem.

    The big problem is that PID doesn't work for steppers. In a servo system, when your 2" endmill hits a large chunk of cast iron, the following error increases and the drive pumps out more current to compensate. This puts more torque on the motor and gets it back on track. If we have a stepper with an encoder, when the endmill hits the chunk of cast iron it puts a torque on the stepper that is higher than the torque that holds it at the balance point and it falls back into the previous "well" a full 10 microsteps in the wrong direction! The following error builds up, and in response the drive commands an extra three steps to increase torque. But a stepper loses torque as it speeds up (due to coil inductance and eddy currents in the iron from the 200 magnetic poles), so the torque pushing back on the motor is already higher than the torque that would cause it to accelerate forward, so it continues on at the same speed. You've just lost a full step but can't do anything about it!

    To be fair, there are some things you could do: 1) slow down the commanded feedrate so it appears to the drive that it's accelerating relative to the commanded position. this should work using something like realtime "adaptive feed" but it has to work fast, your other axes have to decelerate suddenly to stay synchronized, and i've never heard of anyone doing this before 2) add a "boost current" signal to the stepper drive to give the motor more torque for a brief period to recover steps. unfortunately, most drives don't come with this option. also, you might damage the motor's magnets by pushing too much current through it at once, since high performance steppers generally run right on the edge.

    Although closed loop control of steppers may theoretically be possible, all these problems combined with the fact that you will end up needing specialized hardware anyway means that you should just buy the right stuff to begin with.

    The different approach that mariss was talking about is to send a torque or velocity command to a specialized motor driver instead of step/direction. If you go that far, you might as well just design your drive for real AC servo's with a reasonable number of magnetic poles in the first place, and leave the steppers alone.

    I for one would really like to see some inexpensive AC servo drives on the market...
    *glances over at the pile of sanyo denki's*

    Last edited by fenn; 08-29-2007 at 12:45 AM. Reason: minor point about inductance


  14. #14
    Gold Member
    Join Date
    Mar 2003
    Location
    United States
    Posts
    2839
    Downloads
    0
    Uploads
    0

    Default

    fenn,

    I enjoyed reading your thoughtful analysis. I would like to add some of my observations based on the work I am doing. You correctly write it's torque that gets modulated by the output of a PID filter; the filter's input is the position error (commanded position minus where you actually are). The torque command then moves the motor to zero the position error.

    A software PID loop can read where the motor is (encoder), it certainly knows where it should be (command position) and it can difference the two for the position error. It can even run the PID algorithm on the position error Unfortunately the output, step and direction, does not modulate motor torque directly. That requires additional motor information unavailable to the software.

    I guess what needs explaining first is why even bother selecting a step motor as a servomotor candidate. It certainly is a difficult motor to run closed loop.

    Let's start by describing a "normal" servomotor and how it relates to a milling machine's requirements. A normal servomotor's torque is independent of speed; it's torque limit is the same at 1 RPM and at 6,000 RPM. Let's also say the milling machine design rapid is 10-times higher than the feedrate and the machine does nicely with a rapid torque 1/10th of what's required at the feedrate. 1,000 in-oz at 20 IPM and 100 in-oz at 200 IPM on the leadscrew.

    The normal servomotor is geared to give those numbers. The motor is turning at 10% of its rapids RPM at the feedrate. It is also delivering 10% of its rated power at that low speed (RPM times torque = power). During a rapid, the motor goes to 100% speed. Because the torque is independent of RPM, it can still deliver 1,000 in-oz. The rapid requires only 100 in-oz so the motor is delivering 10% of its rated power. The point is never more than 10% of the motor's rated power gets delivered to the load.

    Let's look at the characteristics of a step motor. A step motor is a constant power motor. It's torque is the inverse of speed. The motor develops 1,000 in-oz at the 20 IPM feedrate and only 100 in-oz at a 200 IPM rapid. Nice thing is only 100 in-oz is needed then. The motor is delivering 100% of its rated power at both speeds.

    The problem with open-loop step motors is they are open-loop. Prudence dictates an open-loop motor should be derated to 30 - 50% of its potential to run reliably open-loop. That all changes if the motor is run closed-loop. It can then run on on its natural load-line and deliver 100% of its rated power. The closed-loop step motor effectively becomes 2 to 3 times more powerful than one run open-loop.

    Now let's contrast the two motor types. A NEMA-34 servomotor is rated at 1,000 Watts and a similar size NEMA-34 step motor can deliver only 200 Watts. In the above scenario only 10% of the servomotor's power can be delivered to the load so it is effectively a 100 Watt motor. The step motor can deliver 100% of its rated power. It is effectively twice as powerful in this application.

    Finally, a high pole-count motor is a high torque, low RPM motor compared to a low pole-count motor. It stands to reason; a step motor's rotor is "pulled along" at 50 locations around its circumference simultaneously while a 6-pole motor has only 6 "pull points" around its rotor's circumference. This makes the step motor's torque much higher. The "no free lunch" Law makes it's speed lower than a low pole-count motor's speed.

    This is a good thing. Motors couple to the loads they drive and there is gearing (implicit or otherwise) from motor to load. Let's go back to the NEMA-34 motors. A typical servomotor might have 120 in-oz of torque at 6,000 RPM (530 Watts) while a step motor might have 350 in-oz at 1,000 RPM (260 Watts). The servomotor turns 6 times faster and therefore needs 6 times more reduction gearing. The step motor might even get by with no reduction gearing at all while the servo nearly always needs gearing. Gearing costs money.

    Question: What is a closed-loop step motor called? Answer: A high pole-count AC servomotor.:-)

    Mariss



  15. #15
    Registered
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default

    Ironchips, interfacing the encoder is the easy part, quadrature encoder reading hardware is readily available and given the overhead of handling interrupts on the PC platform, it would be silly to use software for all but the slowest encoder rates. Read carbideBobs post he sums up the problems well, Stick slip and backlash are nasty things to solve by feedback especially with machine flex in the equation, I would introduce feedforward rules to handle this, exactly the same as using a manual machine, you learn to anticipate behavior which is what feedforward is. This is why machine tool makers go to so much trouble to build a rigid machine without stiction and backlash, just to mimimise the range of the system they don't control and to dampen it as much as possible.

    If you are doing plain turning and even tapers, the errors accompanying axis velocity changes are going to be of little consequence but corners and curves especially reentrant ones could show some steps and ripples if the control loop/ loops go into oscillation.

    It is not a current project of mine I have a profile cutter to build which is a very simple open loop unit, though the challenge of closed loop tool tip position control is interesting



  16. #16
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Fenn and Mariss, you came up with some really great reading here.
    This question is returning every now and then, so I'll make this one a sticky.



  17. #17
    Registered
    Join Date
    Aug 2007
    Location
    USA
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default

    This is the student summing up what he thinks he read. Making smooth cuts isn't going to happen with a marginal machine. The accuracy of a CNC milling machine is dependent on rigidity as well as the physics of the drive motor and even the material being cut and the tools being used to do the cutting. So, since it is very difficult to do anything with servos, or steppers and any kind of feed back scheme to make up for a piece of crap mill, just get the good mill, put a servo drive on it if you require the best accuracy and servos if you can settle for less than the best.

    So, professors, is that pretty much the case?

    Thanks for all the great info. I think I am going to enjoy the new hobby.

    John (Ironchops)



  18. #18
    Registered
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    20
    Downloads
    0
    Uploads
    0

    Default

    Ironchips, go with a decent mill, secondhand heavy iron is cheap these days. Though I was answering on the closed loop stuff Fenn and Mariss posted some interesting comparisons between AC servos and Steppers, I will add a few points I think were left out.

    Cogging, cyclic torque fluctuations which usually end up as velocity fluctuations and consequently ripples in the control loop feedback system. DC servos by design of the armature and field poles do a very good job of minimising cogging to the extent that it is undectectable by holding a slow turning servo shaft. AC servos by pole and stator design seek to minimise cogging as well. This lack or low level of cogging contributes significantly to the ease and precision of closed loop servo control. Steppers on the other hand cog in the extreme they have to, as it is the cogging action which drives them in steps and the pole design is set up to maximise this, this cogging will show up as a high frequency ripple on the control loop error signal. It may be possible by careful shaping of the stepper drive signals to reduce cogging but they are 2 phase motors with coincident rotor and stator poles which will never be as smooth as the 3 phase AC servos with non coincident rotor and stator poles. So a servomotor isn't quite a low pole count stepper.

    Another source of error is angular phase shift linked to cogging as well, as a stepper is loaded the error of the shaft position to the desired step will increase up to 1/4 step after which the stepper slips but the servo with a high resolution encoder can stay within 1 encoder count up to full drive current, that combined with the higher gear ratios employed with servos will give finer control granularity with servos.

    Agree with Mariss about the price of servo amplifiers also I wonder where they all go, I have a few AC servos, plenty of DC servos but no amplifiers also there is far too much proprietry hardware in motion control for what is a pretty generic application.



  19. #19
    Registered
    Join Date
    Aug 2007
    Location
    USA
    Posts
    7
    Downloads
    0
    Uploads
    0

    Default

    What is the price range of AC servos and drivers and are DC servos a better bang for the buck?



  20. #20
    Gold Member
    Join Date
    Mar 2003
    Location
    United States
    Posts
    2839
    Downloads
    0
    Uploads
    0

    Default

    It's going to be hard using words to describe what is best seen but I'll try.

    I have a step motor running closed loop here on my lab bench. It is equipped with a 500-line (2,000 counts/rev) encoder. While the motor is stopped I apply an increasing CW load torque to the motor by hand. As the load increases, the motor "steps into the load" (microsteps CCW) to keep its shaft position within +/-0.09 degrees of the original position.

    The motor eventually takes 10 microsteps "into the load" at which point it is delivering full holding torque to servo the motor to the command position. An increase in CW load now causes the motor to "step away" from the load (microstep CW). The motor now servos to the CW lag angle limit (-1.8 degrees).

    This results in the motor motor moving CW from the command position while resisting CCW with full holding torque. The "feel" is silky smooth; there is absolutely no discernible cogging as the motor is forced further and further CW. It feels exactly the same as a DC servomotor would and why not; the step motor is a servomotor now.

    Releasing the the load abruptly results in the motor springing back to the original location without overshoot or ringing. The PID feedback insures that. The motor can be forced off of command position +/- 16 full revolutions before the servo following error limits are exceeded (+/- 32,768 microsteps).

    If displaced 16 revolutions CW, the motor returns to position in 0.45 seconds and reaches a peak speed of 4,300 RPM while doing so.

    Mariss



Page 1 of 3 123 LastLast

Posting Permissions

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


About CNCzone.com

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

Follow us on


Our Brands

EMC+closed loop?

EMC+closed loop?