Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations pierreick on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Math Problem 1

Status
Not open for further replies.

sreid

Electrical
Mar 5, 2004
2,127
This question is sort of motor related (X Axis servo ramping profile) but I put it here because I hang out here a lot and there are a bunch of calculus "Geeks" who hang out here.

We have a lens polisher that spins a lens slowly and a fast spinning polishing ball is loaded against the lens. The spinning ball traverses the lens radially starting at the lens circumference with a velocity (Vs) at the circumference. The velocity then ramps up by the formula

Vc = Vs x Rs/[Rs-x]

Rs = radius of the Lens

x = negative radial position

The velocity is a hyperbola which would have an infinity value at x = Rs but we terminate the velocity to some Vmax at some radial position.

The PLC programmer has a "Brute Force" method of calculating the time to Vmax but asked if the is an elegant solution to the question of Time to Current Position or Time to Vmax).

The equation is in terms of velocity vs. position and I believe there is probably a closed form solution (there may not be) but being 45 years away from Calculus 4, I'm a little rusty. Some of the folks here are more Current and have less gray hair.
 
Replies continue below

Recommended for you

Assuming the velocities Vs and Vc are in the radial direction (as you state) and the negative (?) radial position x is zero at start and goes up towards Rs, you can write:
radial position r=Rs-x
Vc=dr/dt=VsRs/r
and, as r=Rs for t=0 you get
t=(Rs2-r2)/2VsRs and for r=VsRs/Vmax
[Δ]t=Rs(1-Vs2/Vmax2)/2Vs
Tried to double check these formulae, but still should be checked by someone else.

prex
: Online engineering calculations
: Magnetic brakes for fun rides
: Air bearing pads
 
Less hair - at least.

Not quite sure what you are asking. Can you state that again? Is Vc the radial speed with which x moves towards the center of the lens? And that speed increases to keep "work per surface unit" constant?



Gunnar Englund
--------------------------------------
100 % recycled posting: Electrons, ideas, finger-tips have been used over and over again...
 
Vc is the "Current" velocity. One can ignore anything about spinning lenses and polishing balls. The Initial x axis value is zero so the initial velocity is Vs (i.e., Vstart). X then increases in value.
 
dx/dt = Vs*Rs/(Rs-x(t))

Multiply by Rs - x(t):
(Rs-x(t)) * dx/dt = Vs*Rs

multiply by dt:
(Rs-x(t)) * dx = Vs*Rs dt

Integrate both sides
Rs*x - 1/2*x^2 = Vs*Rs*t

Solve for t as function of x
t = (Rs*x - 1/2*x^2) / (Vs * Rs)

Find t when x = Rs:
t = (Rs*Rs - 1/2*Rs^2) / Vs * Rs)
t = (Rs*Rs - 1/2*Rs^2) / (Vs * Rs)
t = 0.5 * Rs^2 / (Vs * Rs)
t = 0.5 * Rs / Vs

The solution looks too simple to be true. Maybe I missed something.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Integrate both sides
Rs*x - 1/2*x^2 = Vs*Rs*t

Note that in general we have to evaluate the difference between initial and final values of the integrated variables. For example the left hand side evaluated at final x minus initial x is equal to the right hand side evaluated at final t minue initial t.. We could skip this particular step in this particular case because the initial values x = t = 0 gives 0 for both sides of the equation so the subtracted quantity is 0 and we can treat x and t as final value.s


=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Here I have rewritten without the "shortcut" (explicitly included limits of integration). Should be easier to follow. Looks right to me but you never know.
dx/dt = Vs*Rs/(Rs-x(t))

Multiply by Rs - x(t):
(Rs-x(t)) * dx/dt = Vs*Rs

multiply by dt:
(Rs-x(t)) * dx = Vs*Rs dt

Integrate both sides

Integral{(Rs-x(t)),x=x0..xfinal)} = Integral{Vs*Rs dt t=t0..tfinal}

[Rs*xfinal - 1/2*xfinal^2] – [Rs*x0 - 1/2*x0^2] = [Vs*Rs*tfinal] - [Vs*Rs*t0]

Substituting x0 = t0 = 0:
[Rs*xfinal - 1/2*xfinal^2] = [Vs*Rs*tfinal]

Substitute xfinal = Rs:
[Rs*Rs - 1/2*Rs^2] = [Vs*Rs*tfinal]
0.5 * Rs^2 = Vs*Rs*tfinal
0.5 * Rs = Vs*tfinal
tfinal = 0.5 * Rs / Vs

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
One thing I see is you don't allow the solution to go to x0=Rs because it blows up. So before the substitution x0=Rs we had:
[Rs*x - 1/2*x^2] = [Vs*Rs*t]

Solution of t for some other value x would be:
t = [Rs*x - 1/2*x^2] / [Vs*Rs]

Even though this does not give x or velocity as explicit function of time, it looks like it would not match the solution you described where velocity approaches infinity when x approaches Rs.


=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Even though this does not give x or velocity as explicit function of time, it looks like it would not match the solution you described where velocity approaches infinity when x approaches Rs.
On second thought, it does match the behavior you described.

t = [Rs*x - 1/2*x^2] / [Vs*Rs]

Can solve x in terms of t using the quadratic equation in terms of x:
0.5 * x^2 - Rs x + Vs*Rs * t = 0

x = Rs +/- sqrt(Rs^2 - 2 *Vs * Rs*t)

Choose the appropriate root
x = Rs - sqrt(Rs^2 - 2 *Vs * Rs*t)

Velocity is the derivative:
dx/dt = Vs*Rs/sqrt(Rs^2-2*t*Vs*Rs)

This velocity blows up as t approaches 0.5 * Rs/Vs which was the time when x approaches Rs. So the bottom line, the solution matches the behavior you described.



The deriviative is







=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Electricpete, Thank you so much. This is in some sense an acedemic question (since we have a solution) but in reality, we need to give the operator a "Polishing Time Countdown" and the Brute Force Method was eating up lots of PLC processing time (enough that it was a concern).

When we reach Vmax, we continue at constant velocity to the center of the lens and at some point start ramping down the polishing force as you start removing material on both sides of the lens center. Time-distance at constant velocity we can handle.

 
Electricpete,

The programmer isn't convinced since his code gives a solution (for a prticular value set) of about 1.7 seconds and your equation gives about 2.5 seconds. His pseudo code appears correct to me and there does not seem to be any round off error happening (I'm not skilled at the language he's using so I can't comment on his actual code). However, if I do both a crude rectangular or trapizoidal numerical integration, I get about 2.7 seconds. Which would be expected since for the Trap integration I used 10 distance steps and for the rectangular I used 20 distance steps (paper and pencil to avoid hidden computer errors) and the velocity estimation will always be low and the total time high.

The discussion was all done via email but I be back at work Monday. I suspect that the programmer will have found his code error over the weekend. If not, Modnay could be very "Interesting." Think "Snarling Engineers Hurling Complexities at One Another."
 
It sounds like you agree with my solution and just need to convince that programmer.

I have attached a numerical solution using Runge-Kutta 4th order fixed step size integration (columns B through F) and analytical solution (column G).

Comparison shows the results (column B vs column G) agree to about the 5th significant figure.

If the problem is:
dx/dt = Vx *Rs/(Rs-x)
x(0) = 0
where Vx and Rs are constants,
Then I'm 100% sure my solution is correct.

You can change the inputs in the green to use my spreadsheet for your inputs. (you might have to copy the formula's further down to reach the endpoint, or delete some rows if it goes past the endpoint... will give negative numbers in row B and error in row G).

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
 http://files.engineering.com/getfile.aspx?folder=66405596-f15e-40ee-ac3f-8ce32c980724&file=sreid_simulation.xls
Another proof is to verify the solution satisfies the differential equation and initial condition.

The solution is:
x(t)=Rs - sqrt(Rs^2 - 2 *Vs * Rs*t)

Plug it into V = Vs*Rs/(Rs-x) and you get:
V = Vs*Rs/sqrt(Rs^2-2*t*Vs*Rs)

Which is the same thing you would get if you had differentiated the expression for x directly

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Hopefully the R-K integration spreadsheet attached above is understandable and transparent.
The equation in cell B11 is:
=+B10+dt_*(C10+2*D10+2*E10+F10)/6
where B10 is the previous x, dt_ is timestep, and column C, D, E, F are four estimates of slope (at the left side, middle, middle and right side of the interval). We have used a weighted average of the 4 slopes, with the middle two getting double the weight of the others. More info on Runge Kutta available in google (you may notice that Slope 1 provides an input to slope 2 which provide an input to slope 3 which provides an input to slope 4).

One more spreadsheet is attached to this message which is a lot more complicated and opaque. It improves the behavior at the very end of the simulation where it starts to blow up. It is a variable step size Runge Kutta 4th order, similar to the ODE45 function in Matlab. As it gets close to the singularity, the step size will keep decreasing. Let it go until it times out on iterations and you should be very close to the endpoint (if not, adjust the iteration limit). The model parameters are entered in green. The grey buttons provide executtion control. The logic is in the vba program... not very understandable, but it's there. The only thing gained over the previous spreadsheet by all that complexity is the variable step size.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
 http://files.engineering.com/getfile.aspx?folder=3c5a58c9-dd04-47e4-93d6-3e652a1cfe71&file=RKF45_sreid.xls
electricpete said:
[referring to the first spreadsheet]Comparison shows the results (column B vs column G) agree to about the 5th significant figure.

Actually, I have understated the agreement. It is around 5 signifant figure for the last row, but that last row is very close to the singularity which is predicted at t=0.1875. We fully expect that the simulations will lose accuracy as we approach the singularity (especially the fixed stpe size simulation). If we back up to examine the results from t=0 thru t = 0.184 in the first spreadsheet, we see match between analytical and numerical simulation in the 7th decimal place (in this case 7 significant figures).

The 2nd spreadsheet with the variable step size... run with the same parameters existing in the spreadsheet, and scroll to time 0.1870. At this point (which is very very close to the singularity at t=0.1875), we still have 10 significant figures agreeent between the analytical and numerical solution!

To get agreement that is so close (7 or 10 significant figures), it simply has to be correct. There is no way that two incorrect solutions obtained by diverse methods can match so exactly.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Electricpete,

Thanks. I mostly do Engineering Management (not really by choice) but someone has to follow up on details like tracking parts orders, finding alternative vendors, etc. As such, my Tech skills are not fresh and it takes me ten times as long to do Tech things than it used to.
 
electricpete,

See clipped email from the Software Engineer, Neal, below. This kind of error does not happen to him often.

Sreid

Steve,

I checked the program I sent you and, much to my dismay, I found a bug in it. WHY DIDN'T YOU TELL ME I HAD A BUG IN MY PROGRAM? The bug appears in the pseudo code I sent you. The line which reads:

if (x > Dm) /* if we haven't yet reached the point of max velocity... */

should be

if (Rs-x > Dm) /* if we haven't yet reached the point of max velocity... */

Anyway, when I fixed the bug then my brute force answer converges to ElectricPete's answer.

Thank you both for this elegant solution to my problem!

Neal
 
Judging from your other posts, I don't think you have lost any freshness on your Tech skills at all. If I had a question about dynamics of dc motors, you'd be the first one I'd think of.

Anyway, glad things worked out.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor