When my mill is stopped, my servos "buzz" bzzz.......bzzzzzz....bzz
I have a feeling is that I need to "tune it". I believe that the story is that the motors move due to imperfect TEST/OFFSET setting) and then EMC "whips the mill back" to original position.
I somewhat addressed it by reducing gain on the amplifiers, to the level when this buzz is no longer annoying, barely noticeable. I postponed this until I would get the table all hooked up, homed and safe with limit switches. Now is the time to address it, so here's my question: what are the tuning parameters to address to get rid of motor buzzing?
It's probably too much differential gain, although it could be your differential cutoff frequency, some other gain, noise in the system (although that's not usually a buzz), friction-induced hysteresis, some other hysteresis, or just plain bad juju.
This is an overall tutorial aimed at software engineers, but the tuning section may help:
(note that there's a link on my website that's BROKEN thanks to Embedded Systems Programming!!!). Note that there are different ways to embed the various gains into a system -- mine is the very best way, but other folks operate under the delusion that theirs is the very best way, so you may find things like derivative and integral time constants + overall gain, or others.
Does it buzz with the computer disconnected? If so, then the tuning problem is in your motor drive. If you have to have the EMC software running to get a buzz then you're more of a nerd than I thought -- I mean, the problem is in the EMC software or the tuning thereof.
If it's just a bit of noise, if the motors aren't overheating and parts are coming out good and the neighbors aren't complaining and your power meter isn't spinning like it's going to fly off into the stratosphere, then you're probably good to go. Detune the thing enough to get rid of the buzz and you'll have to accept lower performance, which means lower milling speeds.
The motor drives close an inner loop around the velocity signal from the tachometers. If they're the source of the oscillation then you can screw around with the outer loop until hell freezes over without fixing the problem.
From the history of the posts I don't think the problem crops up until Iggy connects the EMC2 -- but it's a good due-diligence check that can potentially save you a lot of trouble.
In the link that Karl sent you the guy refers to an inner velocity loop
-- that is the loop that your motor drives close, and that is the loop that must be made right first, before you tune the outer loop. Getting the inner loop tuned too tightly will leave it susceptible to oscillation (or make it oscillate outright) and demand that you tune the outer loop more loosely than you might like; getting the inner loop tuned too loosely will force the outer loop to work harder with both insufficient information and insufficient sample rate.
Next you'll ask "what do these pots do, and how do I twiddle them?". I will respond "every manufacturer has their own way of doing things, and the ones that do it exactly my way are actually doing it correctly." Then I'll say "send a link to your drives' manual, and maybe I'll figure it out."
Just from the sound of it the error gain sets a drive's overall loop gain, while the reference gain turns the whole inner loop's response to a command up or down -- but that's a guess. If that's so then you want to twiddle the error gain pot until the shape of the drive's response is as best as you can get it, then you want to twiddle the reference gain pot until the maximum velocity command out of the EMC2 software matches the maximum velocity out of the drive, without either the drive or the software maxing out before the other.
Does the EMC software provide you with any sort of measuring and diagnostic tools? If it gives you the opportunity to inject test signals into the loop and look at the results then you'll find your job much easier. If it builds a transfer function analyzer into the thing then you're either really lucky or in for some mind-bending frustration or both.
And of course, if it auto-tunes, then you're at the mercy of the competence of whoever made the auto tuning software.
It is expected and inevitable that the drives should drift without being inside a position loop -- electronics have an inevitable amount of bias, and the expense to eliminate it is roughly inversely proportional to the amount of bias you have left when you're done. Since these drives are designed to go inside of a PID position loop, it wouldn't make sense to really pound the bias down.
The problem is more intrinsic than the EMC2 correcting drift, and it may not lie with the EMC2 itself. You are somewhat correct with the "rude manner" (I like that turn of phrase; I'll have to use it). More often than not -- at least at the stage of tuning you're in -- oscillations like this are from excessive gain somewhere. It's probably because the EMC2 is tuned too aggressively, but there's a really good chance that either the drive loop is tuned too aggressively, with a peak in it's response that the EMC2 is exciting, or that the drive loop is tuned too limp and in tuning the EMC2 up tight enough to compensate you're causing an oscillation.
Do you have some means of stimulating the system, and looking at the response? Ideally this would be built into the EMC2, but even just having an oscilloscope and a signal generator would be exceedingly handy.
You should get the drive/motor/tachometer tuned correctly by itself which can probably best be done by disconnecting one from the mill*, putting a square wave into the command input of the drive, and looking at the tach feedback with a scope. Once you get that so that it matches the "critically damped" response in that paper that Karl sent you, then you can put things back into the mill and start tuning the EMC2.
I assume the servo motor is geared down plenty (10:1?) before it drives the lead screw of the mill. If so, then the lead screw moment of inertia probably doesn't matter in the tuning of the system. If the gear ratio _isn't_ that high, then you either need to figure out how to keep the axis roughly centered while you're tuning, or you need to slap a load equal to the lead screw moment of inertia onto the gearbox output shaft to do your tuning.
I just took the time to read the entire article. Some really smart fella wrote that I really like the simple tuning approach on page 6. If I ever get my plasma torch height control built, this article is exactly what I need to know.
Ironically enough, that's not much more than what they teach union millwrights to do when tuning a loop.
The biggest shortcoming of that article is that it gives a tuning procedure that is almost guaranteed to give you a loop that is pretty safe but not optimal. If you want guaranteed stability and the best tuning ever then you have to crack the theory books, and _then_ you have to figure out how to _apply_ the theory books (which the theory books don't tell you, because they're so busy admiring all the pretty math).
Fortunately 99% of the control loops out there can get by just fine with its sub-optimal, "probably safe" tuning. And I get the challenge of working on some of the rest, and people actually pay me for having fun!
Encoders always jitter unless perfectly in the center between state transitions. And, the elastic nature of the whole machine keeps it creeping all the time.
You first need to find out whether it is the servo amps themselves or the positioning loop that causes the buzzing. If you can keep the amps enabled and hit F2 to shut off EMC's positioning loop, and the buzz goes away, then it is EMC that is causing it. First, you need to set the DEADBAND to at least 1.5 x the size of an encoder count, in user units. Too large a deadband can cause discontinuities in the transfer function, but a small amount helps suppress the servo jittering. Some servo jitter is unavoidable, but I have my machine set up so you can't hear it. (I have bar graphs on the current and voltage of the amp, so I know it is jittering, but it is of very small amplitude and only a couple bumps a second.
P is raw position gain, you want it as high as you can to minimize error. D is a damping term, but it doesn't work as well as one might want. The reason is the encoder position is quantized, and so when moving you get a fluctuation in number of counts per servo period. If you were moving at a rate equal to 1500 counts/second, and the servo loop is updated 1000 times a second, the counts would come in at a rate of 1,2,1,2,1,2 etc. So, the PID algorithm would perceive a huge jump in velocity every other cycle. The D term magnifies this and feeds it back into the velocity command output, so too much D causes worse vibrations. You can partially help out the finite gain situation with FF1 and FF2 to correct for steady-state error (FF1) and error on acceleration (FF2). But, hopefully, if you can put in enough D without causing worse rattling, it should help with the buzz. Turning the servo amp gain as high as possible allows you to run with a lot LESS gain in the positioning loop, which makes tuning easier.
Ugh, it would be best to tune the servo amp all by itself, by pumping small-amplitude square waves into the ppmc DAC outputs and observing the velocity out from the PPMC encoder counter. This can be done with Halscope and some HAL commands to set up a square wave generator.
Once the servo amps are giving a good, well-damped but still snappy response, then you can add in the EMC positioning loop.
Iggy has AMC amps. They have pages of how to on tuning their amps for each mode. I haven't bookmarked that section but its not hard to find. Or, their tech help is top notch. they will direct you to the right info.
On most..most AMC amps..turn the micopots clockwise until the buzzing starts..then back off 2-3 full turns. On most machines..2 works fine.
That works for MOST of my applications. And the buzzing when it starts isnt very loud. If you go until the servo is hammering...thats not good.
One could not be a successful Leftwinger without realizing that, in contrast to the popular conception supported by newspapers and mothers of Leftwingers, a goodly number of Leftwingers are not only narrow-minded and dull, but also just stupid. Gunner Asch