Distance Calculation

kamenges

Member
Join Date
Nov 2002
Location
Green Bay, WI
Posts
4,332
This is going to seem an odd post given my responses to the recent scan time thread, but here goes.
We are building a small slitter rewinder for a customer. The max speed is 2500 FPM. We are building child rolls from a larger parent roll. The child rolls need to be wound to an operator entered length. This is not a running transfer operation. The machine stops at the end of every roll. The run speed, the decel rate and both jerk rates are operator adjustable. We need to stop within 3 feet of the operator entered length.
The routine in the attached CLX program does what we need it to do. We can usually stop within one foot of the entered length from 2500 FPM. But this one routine takes about 3 msec to execute. It's also alot of code for what it does.
I know I can speed up execution by going to double integers instead of floating point numbers. However I think I remember seeing a single equation at one time that will calculate distance given speed, accel rate and jerk. Does anyone know where I can find something like that? Now that I have this developed I can re-use it so development won't be painful. I'm just curious if someone knows of a better way.

Keith
 
kamenges said:
However I think I remember seeing a single equation at one time that will calculate distance given speed, accel rate and jerk.

Are you looking for the mathematical formula, or the PLC command to execute it?

The formula will be a polynomial, similar to the old X=A^2 + 1/2V + D. But you'll need a third power term, to account for your change in acceleration (that's what you meant by jerk, right?). You can derive the formula yourself (I'm REALLY rusty), by doing another step of integration. I remember learning how to create the above formula by substituting position for the various terms. You can use the same method to include jerk. You've got me thinking, and I've got to take the FE exam soon, so you might hear back from me.

As far as entering the function into the PLC: there is a "calculate" or "function" command which will allow you to enter the whole thing as one block. There are many postings here on how to do it. I've never needed this feature.

AK
 
Re: Re: Distance Calculation

akreel said:
I remember learning how to create the above formula by substituting position for the various terms.

Oh WAIT! NO!

You make everything a function of TIME! I'll get it yet!

Ouch... Random knowledge... Flooding back...
 
akreel,

Out of curiousity, what are you doing to study for the FE Exam? Are you doing any of those courses they offer or using any of the FE Study guide books?
 
Don't we also need to know the diameter of the child roller to get the initial rotational speed to start with? and the thickness of the material? I am assuming these two will be fixed and will make the math easier. Then for every rotation the RPM (of the child roller) will decrease until the preset feet have been wound onto the child roll. I haven't done calculus in years and this is making my head hurt...lol
 
I'll be taking the course, paid for of course.

But, I've been told that I need to get some books on the discipline specific (afternoon) session. So I plan to start early by getting the course book, sample exams (and solutions), and a book on the electrical exam.

Maybe it's overkill, but why do this twice?


By the way: the formula I came up with is X = J*(T^3) + 1/2A(T^2) + 1/6V(T) + D. Can anyone confirm that?

AK

Oh yeah, and that's LINEAR distance. So this equation works better for throwing a ball or launching rockets. You'll need to do something to convert rotations to linear distance.
 
Last edited:
Thanks for the replies, guys.

testsubject-
I have a pull roll on this line and I am working in feet/second as an internal unit (sorry for that omission). So I calculate everything as a linear quantity and convert to rotation right at the end. I am using an encoder to measure product travel over the pull roll.

akreel-
That looks kind of familiar. However, the 'T' you list below. Is that the total time of the decel or are they actually different values of T for each part of the equation. If they are different, the T for jerk is just accel rate/jerk rate and (I think) the time for velocity is the total time. But to get the accel time I need to figure out the total time and subtract the jerk time. So I need to redefine my total time. I think this is what I ultimately do, just in 6 different parts.
I think the thing that might prevent me from using a single time dependent equation is the constant decel part in the middle.

Thanks for the info.
KEith
 
I have not looked at the RS Logix formula to understand the logic used in depth, but it looks like it takes care of calculating any intermediate decel/acel ramp rates. I can only assume the drive is either DeviceNet or ControlNet monitired by looking at the data types. If you could assume one ramp up and one ramp down then the formula probable could be shortened. Could this logic run on a periodic timed task instead of a continuous task. How about only running this subroutine when required instead of all the time.
Besides how much processing time do you need for other functions on a re-winder. Maybe you are also controlling tension too?

I have a project to start on rewinder controls. This winder has a surface tach I can read. Maybe you could give me some insite to tension needs.
 
kamenges said:
Is that the total time of the decel or are they actually different values of T for each part of the equation.

My formula is a little wrong. I'm scratching my head trying to remember the right way to verify this. I can't wait to get my physics books out again...

But, to answer your question, the formula I'm going for assumes CONSTANT Jerk(J), with initial acceleration(A), velocity(V), and position(D). The T is total time, or the time of your sample, however you want to look at it.

I can tell you right now that I think the velocity term should be V*T and I think I should have made the Jerk term 1/6J*(T^3). That makes MORE sense. You should have the "normal" equation for position vs. time left over if your jerk value = 0.

I think we may also be using different definitions of "jerk." In physics, I understand, jerk/djurk (however it's spelled) is a change in acceleration vs. time (like acceleration is a change in velocity vs. time). You might be describing the physical action "jerk" instead. Or, you could just be making fun of me.

AK

By the way, you'll need to use multiple calculations if you change the jerk rate. Your question seemed to indicate that you're going to "slow down" at some point.
 
Last edited:
Thanks again for the replies.
I should clarify something here. What I have now (what I posted) works the way I intend ot to. It gives me the correct numbers for any 'reasonable' velocity, accel and jerk I use. I was just bored on a Friday afternoon and was curious about a better way to skin a cat. The thing that makes my question kind of odd is my post in this thread. Especially when you consider that the 3 msec runtime isn't causing me any problems.

kevinrcase-
You are correct, the drives are on ControlNet, although the structure you see is more of an organizational tool. I could have just as easily used formatted tagnames and achieved the same thing. The winder function is actually handles in the winder spindle drive so the plc doesn't need to worry about that. The winder block in the drive takes care of diameter calculation so all it needs is a line speed reference. All I ned to do is determine when to tell the line to start decelerating. And you are also correct that I could simplify things a little if I enforced the same jerk rate at both corners.

akreel-
I think you're right about the order of the constants. The 1/6 makes more sense going along with the J term. However, since T is a total time I think the equation requires that the axis be in jerk through the whole decel. There is no constant decel part to the curve. In my case I am not in jerk through the whole decel. Also, once I begin the decel I will go all the way to zero.

Thanks for the info guys.

Keith
 
Not quite right

akreel said:
By the way: the formula I came up with is X = J*(T^3) + 1/2A(T^2) + 1/6V(T) + D. Can anyone confirm that?
The equation you are trying to write is:

x(t) = x(0) + v(0)*t + (1/2)*a(0)*t^2 + (1/6)*j(0)*t^3

x(0), v(0), a(0) and j(0) are the initial position, velocity, acceleration and jerk.

However, even this equation isn't right one to use because it assumes the jerk is constant through out the whole ramp. The jerk must change signs somewhere if the acceleration rate is to begin and end at zero. It is possible to splice two of these third order equations to get a good ramp. Normally you must use a 5th order polynomial to ramp from one point to another with just one equation.

Think about it.
 
Re: Not quite right

Peter Nachtwey said:

The equation you are trying to write is:

x(t) = x(0) + v(0)*t + (1/2)*a(0)*t^2 + (1/6)*j(0)*t^3

Thanks for polishing the rust off! I feel much better now.
 
Last edited:
Keith,

If I understand you correctly, you're looking for a stop-to-length formula. You know the slope of the velocity profile (acceleration) and the slope of the acceleration profile (jerk). You're keeping track of the total footage of paper on the rewound roll and you need to know how many feet before the target length to initiate a stop sequence.

Let's say you're running at 2500 FPM. That's 500 IPS. To make the arithmetic easy, we'll use a deceleration rate of 20 IPS^2 and a jerk rate of 10 IPS^3. With those numbers, 2 seconds after initiating a stop, you'll have reached the peak decel rate. At that point, your line speed will be 1/2Jt^2 slower, or 480 IPS. You will continue to decelerate at 20 IPS^2 for another 23 seconds until you reach 20 IPS. At that point your decel rate will ramp down for two more seconds until it reaches zero concurrently with velocity reaching zero.

If you plot velocity vs time, velocity will be a horizontal line until you start decelerating, then a rounded curve for two seconds followed by a diagonal straight line for 23 seconds, then another rounded curve for the final two seconds. The area under that velocity profile is the distance traveled.

Without going through all the algebra, the formula you want is:

X = [V^2 / (2 * a)] + [(V * a) / (2 * J)]

where V is the initial velocity, a is the acceleration rate, and J is the jerk rate.

Plugging in the numbers from the example gives you 6750 inches.

As a sanity check, look at the case where there is no rounding of the transition from constant velocity to deceleration (jerk is infinite). In that case, the distance traveled is the area of the triangle whose height is 500 (IPS) and whose base is 25 (seconds) = 1/2 * 500 * 25 = 6250 inches. In the formula, infinite jerk makes the second term go to zero and the first term evaluates to 500^2 / 40 = 6250.
 
It might take the fun out of it, but...

Have you considered using the S-Curve function block provided in CLX?

Just plug in the accel, decel, and jerk rates you want and let it do the work. Use Steve's formula to decide when to drop the block's input setpoint to zero. Oh, and set any ramp times in the line drive(s) as near zero as possible.
 
Steve-

You are correct. I'm looking for a stop to length formula. And what you show definitely works (although I imagine you already knew that). It checked correctly against my routine, which I know gives the right result. Your equation is SIGNIFICANTLY simpler, though. When I did my original routine there was a requirement for dissimilar jerks at the two ends of the decel profile. I still don't know where THAT requirement came from. So my routine busted everything apart so the two jerk values could be different. I wouldn't have come up with your equation either way, though. I'm just not sure why your equation works. It looks like the sum of a standard linear deceleration distance plus half the distance covered at full speed during the jerk time. The first part I get, the second part not so much.


Gerry-


You ARE taking the fun out of it!! :)
The drive system we are using is generating the ramp. Good thing, too. We never purchased the FB programming add-on to Logix5000. So I don't get to use the S-Curve FB. I just needed the stop distance value so I know when to trigger the decel. I did build up an S-curve velocity command generator in a PLC5 for a similar application. But if it comes to that it may be time to buy the add-on.

Thanks for the posts everyone.

Keith
 

Similar Topics

Are there any documents or standards for calculating the response time for a controls system? For example: Light Curtain response 20ms Safety...
Replies
3
Views
3,853
I am trying to calculate the safe distance for a light curtain. What's a good way to determine the maximum stopping time of a hazard? In my case...
Replies
17
Views
8,101
Hi guys, first time post so don't be too angry. I am basically a stupid person so I could use some help. I have created a FB that will output a...
Replies
7
Views
5,260
In a motion application I want to stop my motion at a certain point. For that point I want to know the distance it wil take to stop. The motion is...
Replies
20
Views
9,036
Hello everyone, What's the difference between nominal sensing distance and maximum sensing distance in a diffuse photoelectric sensor ? in...
Replies
1
Views
1,117
Back
Top Bottom