Hello Guest it is April 16, 2024, 09:13:52 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ART

891
General Mach Discussion / Re: Problems threading on the lathe
« on: October 05, 2009, 11:10:53 PM »
Simpson:

  Just had a refresher on how I did that in the threading module. I figure a better explanation is in order of exactly how I
manage single point threading. I tend to agree on the face of it with those that say its impossible, but when I developed it
I wasnt aware of that. :-) , so I did as cloase as I think could be done given the restrictions in architecture.

 So we have to accept certain givens..

1) Motion is preplanned, in a buffer of steps. This buffer can be considered an endless array of bytes. most of the time each entry will be zero. Each interrupt cycle.. at 25000 times a second, an array iten is retirved, and analysed, if a bit 0, for example is a 1, a step is put out on the X motor. If its a zero, no step is put out, if -1, a backwards setp is put out. That array item is delted, and next interrupt we get the next one( This is all simplified for examplication. )

2) Due to this, the driver of course knows nothing about speed, acceleration, or even if a motor is stepping or not, we simply have an array of bytes, and we step though that array one byte at a time. Mach3 continuously refills this array of bytes so the next stepo will be correct.

3) TO measure RPM, we count how many interrupts between each index pulse. This is divied out to find the rpm. ( The advanced threading uses time as the measurement)

Ok, so we have those limitations, we have no idea what speed any motor is moving.. or even if it is. BUT, we know time is linear, counting at 25000 steps a second. We know prior to the threading starting that the spindle is hitting index every 11345 interrupts. ( for example).

 So when threading starts, we start a counter.. we count the number of interrupts between each suceeding index pulse and place it in a var called CURRPM.. Then, every interrupt we add CURRPM to our originally zeroed counter, we then subtract the reference index pulse count. If this number is greater than the reference count, we skip an interrupt processing. This is a bresenham divider time relinearisation of the pulse streams time, not the motor motion directly. A motor moving at full speed, would then have 1 step delayed till next interrupt, but normally, this operation would be a small fraction of one step of a motor in time.

   Thats a bit hard to understand.. consider this sequence of events..


Kernal speed 25000. Threading is commanded and spindle RPM is 120. An index occurs every 12500 interrupts. Threading begins..

On each interrupt counter = (counter + currpm) - refrpm

we start with..
Counter : 0  CurRPM: 12500  RefRPM: 12500

  The counter wont change for 1 full rotation, its always getting 12500 added to it, and 12500 subtracted from it..

Now the next interrupt comes in at 12900..

So on that interrupt, the counter is now 12900 - 12500 = 400.
Eachinterrupt this number will increase by 400. When it hits 12500, an interrupt is skipped. Not a motor step, an interrupt.
This means time is stretched, the motor motions, all equally are slowed by 1/25000 of their time base. The ref is then subtratce from the counter and it all continues.

  This means that as each rotation slows..or even maintains its new speed, the error count grows, and is compunded by further slowdowns
so it actually has a sense of history. Time corrections are also applied linearly across the motion for this correction. And since the number subtracted when an interrupt is skipped is the ref rpm, fractional counts are kept, and spread across the next rotation. As the speed increases to normal speed, the counter approaches equilibriam again with its total zero.. and no further time intervals are skipped.


  This is all necessary due to the way motion is planned before the threading begins, so all we can alter is time itself, not anything to
do with motor motion.

   You question is well put though, if the spindle has slowed by 1%, we can then pretty much anticipate that the next will also be 1%, so why not double down and correct at 2% for the first slow rotation. You cant really do that though as you cant really make that assumption. It could be just a slightly slow index input for example.. so its best to stay exactly one rotation behind at all times. Mathmatically its the best one can do with a single input, If the RPM is, indeed ,slow on the next by 1% again, then it hasnt changed, nor will the algorithms slowdown, it will be exacly 1 rev behind, but if for whatever reason the rpm increases back to normal, ( VFD self correction for example ), then the algorithm will automatically speed back up to normal and we'll be exactly 1 rev behind it again.  

  The only way we get fooled is if the vfd speeds up to a speed greater then the start reference speed, in which case the error from the previosu rev cannot be corrected, and will be forever locked in, and will grow on each rev that is faster than reference. However, since remainders are taken into account by the bresenham, its counter goes negative by the uncorrected amount, and should the rpm slow down, the algorithm will not slow down to compensate until the over speed that was uncorrected is eaten up.

   Its a pretty simple algoritm, simple enough to be very smart. Overspeeds will be corrected when and if they can, underspeeds will be 1 rev behind at all times, and very small fractions are accounted for. Its why its actually possible to do this without knowing anything about the motors motion, its simply the matching of two varying time bases by a counter than keeps track of total time with no capability of rollover.



Hope this explanation helps, it actually helped me to write it and get reaquainted with how the heck the code works in the first place.

Thx
Art

892
General Mach Discussion / Re: Problems threading on the lathe
« on: October 05, 2009, 10:31:19 PM »
Rich:

   Interesting. Youve proved that computer is very stable, its also interesting that at 115 RPM it seems no matter what pitch, .8% increase in pitch will
make it correct. Be interesting to see how that scales with feedrate. By the way, have you ever used the advanced threading plugin to see how the RPM
measurement differs from the normal Mach3's? Id be curious as to hwo it reports RPM vs how the normal Mach3 reports RPM..

 In the advanced threading plugin, if you set the timing and index inputs both the the index pins input, it will act as if you have a 1 slot wheel on it, and will read
the RPM based on actual time, not interrupts.


Simpson:

    The code actually does carry history forward.. Ill see if I can come up with a better explaination of how it does that, really I need to get in there and study its behaviour a bit
to refresh myself before I attempt it. Ive been working on Tempest a bit too long, I get a bit rusty on the threading code. :)

Art

 

893
General Mach Discussion / Re: Problems threading on the lathe
« on: October 04, 2009, 08:49:48 PM »
Rich:

 Well, at least youve proved the kernal speed we end up with is not a factor. I suspect we can eliminate that, there is correction in the code for that, and it appears to work as all kernal speeds appear the same. Im thinking we simply are a few rpm off in spindle speed measurement.. ( .8% perhaps?) or somethign similar..

Art

894
General Mach Discussion / Re: Problems threading on the lathe
« on: October 04, 2009, 05:59:16 PM »
Hi Rich:

  Seems pretty stable.. Almost like its correctable by adding a correction factor for a person to enter. I suppose one could make the feedrate command .8% faster.. but Ill come up with some tests to prove what the heck it is if I can.. Still dwelling a bit while I finish up my workshop..

Art

895
Theres ALWAYS an excuse.!!  :D

Art

896
Hi Mike:

  Thx for the report, its nice to hear.

 Actually though, I suspect retirement is necessary to do this..lol ..

The code took a long time, and you had to go on faith that it woudl make a difference as I couldnt actually move a motor till now.
It does seem much smoother though..

 Anyway. Ill let people test for a couepl months before I continue on it, Ill work on lathe code till then while this project steeps a bit.
Though if problems develop Ill fix each reported error till we know what we have so far is bulletproofed..

Thx
Art

897
General Mach Discussion / Re: Problems threading on the lathe
« on: October 03, 2009, 11:03:10 AM »
Rich:

 Take your time.. no rush on this stuff at all..

Art

898
General Mach Discussion / Re: Problems threading on the lathe
« on: October 03, 2009, 10:41:33 AM »
Rich:

  Excellent. That will allow me to make some changes.

 The tests youve been doing all use the original MAch3 threading code, with no real changes to the timers, they still use the number of interrupts
as thir trigger. Im looking at updateing that to PCI bus timing, which is in nanoseconds. Im thinking that way if the computer is less than stable, it wont matter
as only the actual time from index to index will count. It should make the rpm more accurate ..

Thx
Art

899
General Mach Discussion / Re: Problems threading on the lathe
« on: October 03, 2009, 09:08:27 AM »
Hi John:

   Your right of course, slaving to an encoder woudl give perfect threads. The problem is that Mach3 uses Windows in a semi-real-time environment.
While I managed to make Windows run in real-time, I cant do division in the driver. There is no easy way to do a geared slaving. I do have already
a encoder type of threading driver. We use a 100 slot wheel with a separate index pulse. BUT, its still a game of timing and uSecond timing, though the
statistical revelance of the numbers are higher.
   I cant fully explain techincally why  we have to deal with it the way we do, but its a result of the technical challenges faced when trying to make Windows
run in a real-time mode. Take an encoder for example, if it runs at 600rpm and has 100 slots per wheel, thats 1000 inputs per second, and the kernal typically
only runs at 25000 , so it leaves only 25 intervals between slots to do corrective actioins, and without a proper floating point gearing, its very hard to arrange.

   I worry about accelerative discontinuities and jerk from disturbing the waveform too much due to corrections. In the end it boild down to a rather easy solution in the
mind, if an output is planned at a certain spindle speed, we may have to put out 3 steps per encoder pulse for example.. but the triggering of this is very difficult and its
why the threading is triggered to go, then slowly adapted to changes.. its really all due to the lack of floating point in the driver. There are ways around that, and I
may in the end have to go there, but its far from simple, so all this testing is really about finding all the variables, and seeing exactly whats necessary as a result.


 Rich:
  Understood, sorry about that version, Im not sure why it wont put out for you, seems to work well here.. but Ill investigate to see if I messed up somewhere. 
My entire thrust was to try to make it weasier on you, not harder, so drop that version till Im sure I can make it work better for you.
The problem with .027 is it doesnt have certain corrrections in it to allow me to do a simple driver change to switch the way things are done.

Art

900
LazyTurn / Re: LazyTurn
« on: October 02, 2009, 06:17:32 PM »
Dennis:

  Yup, getting colder.  Ive already laid Termpest to rest fer a bit so I can refocus on LTurn. Ive been investigating this week exactly how the finish pass
might work, with luck it may be by the end of the year or perhaps sooner.. depends on how those investigations go. :)

Art