Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: native34 on October 05, 2017, 05:40:06 PM

Title: Strange occurence in Mach 4
Post by: native34 on October 05, 2017, 05:40:06 PM
I have been having an issue with my mill. The servo motors seem to have a slight oscillating when the machine is running. Lets say I jog the X axis from left to right. The axis will move as commanded but when it stops sometimes it will oscillate for anywhere from a few seconds or until I move the axis in the other direction slightly. It usually only happens with my Z axis, but now I've noticed it with my X axis as well, although still not as much as Z axis. Now this afternoon I had my controller running and PC running but Mach 4 was not running for about 2.5 hours. During this time I had not noticed the issue, event when I tried to move the axis by hand. It seemed very stable. Does anybody have any insight as to what could possibly be the problem?

Rod 
Title: Re: Strange occurence in Mach 4
Post by: ger21 on October 05, 2017, 06:52:02 PM
Servo tuning maybe?
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 05, 2017, 07:36:39 PM
Hi,
as ger21 says your servo tuning is slightly off.

What servos and drives are you using? For a situation like yours where the setting is very close to right try backing off
the integral component by 5%. You may need to up the differential component by a similar amount. Variations of a few percent
either way around the current settings should suffice. If you find you need a more radical adjustment then I would suspect
some other fault.

Make sure you write the settings down before you start fiddling.
Title: Re: Strange occurence in Mach 4
Post by: native34 on October 05, 2017, 10:46:06 PM
I'm using the DG4S-08020 DC Servo Drive by cncdrive.com also sold by cnc4pc.com. https://cnc4pc.com/dg4s-08020-dc-servo-drive.html The servos I am using are made by kelinginc they are NEMA34 850 oz/in Dual Shaft DC Servo (KL34-170-72) SKEWED ROTOR DESIGN https://www.automationtechnologiesinc.com/products-page/nema-34-dc-servo-motor/kl34-170-72/ . Ok I will give that a try thanks for the quick reply.
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 05, 2017, 11:32:46 PM
Hi,
I take it you have the servo configurator from CNCDrive? Looks like its reasonably easy to experiment with the settings.
Do write down what you start with so that you can go back and start again.

Theres a reason control engineers are bald, it comes from pulling their hair out over PID settings. Oh boy, are you
in for a treat...LOL.

Craig
Title: Re: Strange occurence in Mach 4
Post by: mark4 on October 06, 2017, 12:53:32 AM
hi was it working better before. i ask because how is your oiler does your ball screw and ways have enough lube. i have seen allot of problems because somebody decided to use motor oil not way oil or similar. i would turn the machine completely off and turn the screws manually how do they feel tight loose. to tight is bad too loose is also bad you want the middle ground. if you aren't getting enough lube you will kill a ballscrew one of the machines i rebuilt had the oiler tube get broken for the x ballscrew by the time it got to me i didn't need any tools to tell it needed to be replaced. oil is your friend. here is another trick i have used with gummy oil orifices take kerosene pump it through the oiler till everything loosens up then follow with proper way oil.
mark
Title: Re: Strange occurence in Mach 4
Post by: native34 on October 06, 2017, 04:12:47 PM
Joeaverage, LOL! I've had plenty of pulling my hair out over servo tuning when I initially installed them. I had them running fairly well. The only one I had a problem with was the Z axis and it was only going in the down position. Once I moved the Z back up a few clicks it would stop the oscillating, but now it has since creeped into the X axis as well and I'm not understanding how this has just started getting worse without me changing anything. I am new to servos. My previous installations and experience has been strictly with steppers. Which I never had these problems with them, but I was told that I should be using servos as they are far superior. So I decided that with this build I will give them a try and for the most part they work well, except for this oscillation issue developing.
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 06, 2017, 05:00:51 PM
Hi,
I don't know whats changed but something has. The norm when setting up PID is to go for the fastest response with least following error.
Those conditions also put you right on the verge of instability. Any small change will often see low level oscillatory motion. When you set up
you tuned for absolute maximum performance now you need to de-tune for reliability.

If you were modelling this with Matlab you would tune for desired performance and then do a Monte Carlo analysis. The Monte Carlo analysis
varies all the parameters in a usually small but statistically random manner while observing one or more performance indicators. Requires a lot
of computing power. What is does do is show up elements in your system which with minor variance either manufacturing tolerance or wear
will cause a large deviation in desired performance. You can make tuning allowances or redesign that component or whatever...

The upshot is that it could be the aging of a capacitor or resistor inside the drive nut in the feedback loop. It may also be about the mechanical load,
either the weight has increased, you know that added dial gauge or extra thick vice jaws etc or a change in frictional forces due to wear or lack of
lubrication.

A while ago I bought an Allen Bradley servo and drive off Ebay for use as a spindle motor. I ended up buying the Ultraware software that is used
to program the drive. Must say I didn't appreciate having to pay for it but I needed it and bit the bullet. The advantage of the software is that
the EXACT model of my servo was alredy in the memory, including phase resistance and inductance, magnetic losses at various currents, rotational
inertia and more. There is more info in the software than I can find in the specs sheet and certainly way more than I could reasonably be expected
to measure or estimate. All that info meant I just set up how I wanted the servo to behave, max speeds, torques etc and that's it! All the PID stuff
was already done! Amongst the facilities of the software is an oscilloscope. I've used it to track my actual servo response and its bloody good, I could
make it worse by fiddling with the PID settings but doubt I could make it better.

Have to commend the idea that if you buy a servo buy the matching drive from the same manufacturer with that manufacturers software will result
in optimum performance with the least frustration.

Craig
Title: Re: Strange occurence in Mach 4
Post by: native34 on October 06, 2017, 07:28:31 PM
Thanks for the explanation. I wish this was a matching setup servo to drive. Unfortunately these two items are from two separate manufacturers. To make matters worse the instructions are lacking as far as I'm concerned. I followed the instructions but can't seem to get the desired results and when contacting tech support, forget about that. I have tried to contact the drive manufacturer and he never returns my emails. Although some others have stated that his support is excellent. All I can say is that maybe the case previously but not anymore. I have also tried to go through his US distributor CNC4PC and he is also very hard to get in tough with. What ever happened to support. When I used to have a problem I would call support and they would gladly walk me through the problem and get the issues resolved. Now everything is "send me an email and I will return it if and when I feel like it" meanwhile all this equipment you paid good money for is going to waste and costing you money if that is what you are using to make your living with. I guess this is why people pay more money to go with companies like Haas, Fadal, Fanuc, etc.. I really wish there was a better alternative to the servo drives than Gecko, cncdrive, and all the stuff that is currently out there that is lacking usability and support. Sorry I didn't mean this to turn into a rant but these issues are really frustrating and not being able to get real help just pisses me off. rant is over. Joeaverage and the rest of the guys on here who have lended support this is in no way meant for you. I appreciate all the help you have provided me. It is meant towards the guys who take your money and then forget you exist when you have issues.
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 06, 2017, 07:51:06 PM
Hi,
I think the solution is in your own hands, the servo you selected and bought is a brushed DC servo and is pretty old hat design wise. The drive is also
old, tried and trued technology. Don't get me wrong, these devices when setup correctly and assuming they have been adequately specified from the outset
will give many years of faithful service.

The current servo design technology is AC servo, they have a few different names but they all hark back to a concept first published in the engineering
literature of the 60's call 'field oriented control'. If you are interested in engineering history it worth a read. In the early days various analogue techniques
were used to achieve field oriented control. Good quality analogue tends to be expensive. As a consequence the technology was not very widespread prior
to the 90's. With the advent of powerful industrial microprocessors with sophisticated hardware periphials the floodgates opened and now field oriented control
is the norm.

Along with the microprocessors came EPROM and equally inventive modes of operation all available by program. As the programming became greater the
need for a PC interface and the rise of 'manufacturers software'.

Sorry to say it but that PC/ drive firmware/servo combination is commonplace with the current generation products whereas yours date back to the prior
level of technology where that sort of integration didn't exist.

Craig
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 06, 2017, 10:05:12 PM
Hi,
the servos and drivers you've got will work an absolute treat once you get them 100% sorted. Many a hobbyist CNCer would give their eye teeth for
that set up, me included.

To understand PID settings and stability in depth requires University level mathematics and many an Electrical Engineer will regale you with stories of
trying to understand pages of seeming incomprehensible mathematics for the purposes of passing exams.

In absence of that detailed understanding you have to rely on heuristic methods.

The essential feature of any servo loop is that the servos actual position is compared with its ideal programmed position. This is called the error term.
If for instance your servo is at 100.5 degrees when the programmed position is 102 degrees then the error will be -1.5 degrees, minus because its lagging
behind. The amplifier in the drive will increase its output voltage a little bit to encourage the servo to catch up. How much it increases its voltage
for a given amount of error is where PID comes in. The higher the gain of the amplifier will cause the voltage to increase markedly, the servo accelerate
and catch up. This is called the Proportional gain. In general you wish the proportional gain to be high so that the servo quickly responds to an error
and so minimise the error.

Imagine this servo is on the Z axis and the weight of the spindle causes the servo to want to drift clockwise as the Z axis slumps under gravity. The servo
drive would recognise this as an error and produce a voltage that causes the servo to drive counter clockwise. Ideally they would cancel out, but they don't,
not quite. Just to hold the axis against gravity requires a little voltage to try to spin counter clockwise even though it doesn't spin at all, its balanced.
This will mean there will be a small amount of error, say 1 degree. This is an example, contrived to be sure, but still an example of following error.
The solution to this error is to have an integrator in the error loop as well as the proportional term. The integrator will cause the amplifier to up its output
just enuf to cancel the following error. The aim here is to have enuf Integral gain to quickly and reliably reduce the following error to zero.
The downside is that excess integral term can cause oscillations.

The solution to the instability often introduced by the integral term is Differential. It is analogous to frictional damping, sometimes called viscous damping.
The aim is to add enuf differential term to cause the loop to be stable without adding so much as it becomes lethargic.

Your servo setup is very close to correct. A very small reduction in integral gain will reduce its tendency to oscillate quite a bit when the reduction
of performance in reducing following error will be hardly noticeable. You could increase the differential term to increase the damping but you'd probably
have to up it quite a bit to get the same result. If all else fails you may have to reduce the proportional gain, really the whole business with integral and
differential terms is just a means of increasing the proportional gain AND keep it stable. If you push the proportional gain too high then you have to do
pretty radical things to keep it stable and if circumstances or the load changes it could go back to oscillating.

Craig
Title: Re: Strange occurence in Mach 4
Post by: native34 on October 07, 2017, 12:05:18 PM
Thanks Craig, I will have to check out the PID loop and try to lower my Integral gain and see what performance that yields.
Title: Re: Strange occurence in Mach 4
Post by: joeaverage on October 11, 2017, 03:47:58 AM
Hi native34,
have you had a chance to experiment?

Craig
Title: Re: Strange occurence in Mach 4
Post by: native34 on October 11, 2017, 01:46:50 PM
No not yet. I have a couple of jobs to finish before I can take my machine down. Hopefully I will be able to get to it this weekend. I will keep you posted.
Title: Re: Strange occurence in Mach 4
Post by: arturod on November 05, 2017, 08:32:04 AM
Native34,

I just found this thread in our forum in which you state that you could not get support for us for tuning the servo.  I am not sure you reached to us, but we have a ticket system and you can open a ticket with this and we will give you a hand:

https://cnc4pc.com/contact/

The problem you are having is a tuning issue and the advice you have been given here is right on.
Here are other resources that may help you:

Tuning guide: http://cnc4pc.com/Tech_Docs/PID_tuning_eng.pdf

Sample Configuration file for that motor: http://cnc4pc.com/Files/DG4S08020-34-180-72.PID

Arturo Duncan
https://cnc4pc.com