Peter Nachtwey
Member
You can roll your own but you must always use the right time to calculate an accurate formula for the times above. The result should be much better than using a linear ramp.
I'm working on a similar S-curve with ControlLogix - is there a shortcoming by rolling my own general logistic function, providing raw output with a single CPT instruction? Mathematically this works, but I haven't the hardware on hand yet to measure the scan time impact.
This can be called on RTC pulses at selected intervals to tune output resolution and scan times, I suppose.
What is needed is a s-curve index into the SCP instead of the timer like this:
f goes from 0 to 1. Now use f to index into the SCP instruction.Code:frac = time/ramp_time; f=(3-2*frac)*frac*frac;
Simple.
Fifth order polynomials cost extra.
Assume move will be neither acceleration- nor velocity-limited, so jerk will (1) have constant magnitude, and (2) flip sign half way through.
is f(frac) a position or velocity?
It looks like you assumed it is a position so your solution ramps up and down since the velocity is 0 at both ends.
Usually people want to start with a velocity of 0 and ramp up to a velocity of 1 as a function of f(frac).
Most people use that for ramping velocity set points.I dunno, you tell me: you supplied the formula back in post #4!
Yes, it works for ramping just about anything but yes,Ah, my mistake; the OP was asking for a way to control the speed reference.
YesWell, if f is fractional velocity, then velocity is 0 and 1,
yes, if you are ramping velocities.and accel is 0 and 0,
No, ifat a frac of 0 and 1, respectively. Jerk is single sawtooth, and jounce (dJerk/dt) is a positive and negative pulse.
vel(f) = a+b*f+c*f^2+d*f^3
acc(f) = b+2*c*f+3*d^2
jerk(f) = 2*c+6*d*t
Yes,I have a couple of ways of figuring these out but I use Mathcad. This simple problem can be done in my head. If we assume the parameter is a fraction from 0 to 1 then the formula is in he form@brimal was asking for the derivation, and the math is the same. So although I got the labels wrong, they are not really important for answering that question.
...
velocity(f)=a+b*f+c*f^2+d*f^3
acceleration(f)=b+2*c*f+3*d*f^2
Two other things to check when using a ramping scheme algorithm
1. What is the peak acceleration? We judge this as the ratio of the peak to average acceleration. If the peak acceleration is too high the torque/acceleration/force limits could be exceeded.
TimeRamp.PRE := abs(SP - PVinit)/IPM*60000;