Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

S-curve acceleration

Status
Not open for further replies.

swag61

Electrical
Oct 3, 2003
4
Does anyone know of an algorithm that would generate an S-curve pattern? I am trying to program a PLC to accelerate a machine component. Unfortunately, Allen-Bradley does not provide an exponential function in their instruction set, although they do have an x^y power instruction. I have some idea mathematically how to generate the curve; I thought someone might have ideas that substantiate my understanding of the programming requirements. Most motion controllers and VFD's provide s-curve capability, so the algorithm must be well understood. I simply can't find any code listings for ideas.
 
Replies continue below

Recommended for you

Try a logistic sigmoid function. It is s-shaped, and has the form:

y = 1/(1+e^(-x))

You may have to play around with scaling input and output and possibly adding a bias to get it to work the way you desire. You can add biases to change the y-intercept:

y = 1/(1+e^(-x))+b

or the x-intercept:

y = 1/(1+e^(-x+b))

or both, of course.
You'll have to use e = 2.71828 with your x^y function since there is no e in your controller.


xnuke

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Thanks for the timely responses everyone.

I had read this app note previously. It provided insight and helped generate my request for an algorithm. So how would you implement a first order filter with PLC code? Obviously, it would be a digital filter. Any FIR filter programs I've seen were fairly elaborate. Any ideas?

Further, after finding an appropriate filter algorithm, I would have to "generate" an acceleration "signal" to "pass" through the filter. Sounds interesting...

Although I am interested in pursuing the code for a PLC filter implementation, I think XNUKE's suggestion to use the logistic sigmoid function is feasable as the curve readily mimics the shape of the veleocity profile I am seeking.

Thanks again. Any more suggestions will be appreciated.
 
The link given by IRstuff shows the z-domain equation for a low-pass filter, but not the time domain difference equation needed for programming in a PLC. In the discrete time domain, a low-pass filter can be programmed as:

y(k) = [c/(c+T)]*y(k-1)+[T/(c+T)]*x(k)

where c is the time constant, T is the sample period, k is the sample index, y is the filter output, and x is the filter input.

I think it might be easier to program the logistic sigmoid, although I have used this difference equation on a PLC to implement a low-pass filter, and it does work.

xnuke

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Hi, the old way is to intergrate the control signal twice.
 
Just to keep things straight.....

The derivative of Position... is Velocity
The derivative of Velocity... is Acceleration
The derivative of Acceleration is the JERK
function ... (change of acceleration per unit time)
from whence cometh the S-Curve ...

Ergo, the S-curve eminates from the 2nd derivative of Velocity.

 
and to further clarify....

A linear increase in velocity implies -
A constant acceleration (step function) implies -
An "infinite" jerk function (impulse function) -

implies I do not want a linear increase in velocity
but an S-curve velocity profile
or a sawtooth acceleration profile
or a little jerk.
 
There is a very simple way to do this, especially if you have a PLC. Just use a loop where, when you want the linear part of the curve, you step the speed reference a fixed amount. For the S part, you increase the reference is small amounts until it reachs the step size of the linear value. At the top end when you get withing a certain percent of the desired speed value, you decrease the step size. This works very well and is quick to implement. After you play with this you will see the S portion is adjustable, depending on what you want it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor