See discussions, stats, and author profiles for this publication at: https://www.researchgate.
net/publication/361437580
S-Curve Motion Profiles -Vital for Optimizing Machine Performance
Preprint · June 2022
CITATIONS READS
0 482
1 author:
Kamlesh Chaudhari
L.B bohle
31 PUBLICATIONS 10 CITATIONS
SEE PROFILE
All content following this page was uploaded by Kamlesh Chaudhari on 21 June 2022.
The user has requested enhancement of the downloaded file.
S-Curve Motion Profiles - Vital for
Optimizing Machine Performance
Many companies Provide S curve Motion Solution using PLC block or through importing Library
You can use it and run machine without jerk free
But if you have not such library or function block .. here is solution for your machine
Motion control engineers spend hours optimizing tuning parameters for their servo-based motion
controllers. But what if they are using step motors? And what if, no matter how much time they
spend on tuning, they can’t get the performance they want? The answer, for many systems, is to
focus on the motion profile instead. In the past ten years advanced profiling features such as
asymmetric acceleration/deceleration, 7-segment S-curve profiling, change-on-the-fly, and electronic
camming have become widely available, providing engineers with new tools to make machines work
faster and better. This article will take you through the mathematics of motion profiles, discuss which
profiles work best for which applications, and provide insights into how to “tune” your profile for
maximum performance.
In the context of a point-to-point move, a full S-curve consists of 7 distinct phases of motion. Phase 1
starts moving the load from rest at a linearly increasing acceleration until it reaches the maximum
acceleration. In phase II. the profile accelerates at this max. acceleration rate until it must start
decreasing as it approaches the max. velocity. This occurs in phase III when the acceleration linearly
decreases until it reaches zero. In phase IV the velocity is constant until deceleration begins, at which
point the profiles decelerates in a manner symmetric to phases I, II and III.
A trapezoidal profile, on the other hand, has 3 phases. It is a subset of an S-curve profile, having only
the phases corresponding to #2 of the S-curve profile (constant acceleration), #4 (constant velocity),
and #6 (constant deceleration). This reduced number of phases underscores the difference between
these two profiles: The S-curve profile has extra motion phases which transition between periods of
acceleration,
1. PLC Program
Frist calculate Velocity, Acceleration, deceleration Using Below Formula
Or used below Function
//Calculate Velocity
//Total Time
//Acc Time
//Dec Time
//Distance
//Jerk Percent % 0--100
Velocity:=Distance/((Tacc/2)+(Tdec/2)+(Ttotal -(Tacc+Tdec)));
Velocity_GVL:=Velocity;
IF Tacc<> 0 THEN
Acceleration:=(Velocity/Tacc)/(1-Jerk_Percent/200);
Acceleration_GVL:=Acceleration;
ELSE
Acceleration:=0;
END_IF;
IF Tdec<>0 THEN
Deceleration:=(Velocity/Tdec)/(1-Jerk_Percent/200);
ELSE
Deceleration:=0;
END_IF;
IF Acceleration<>0 THEN
Acceleration_Dst:=(EXPT(Velocity,2))/(2*Acceleration*(1-Jerk_Percent/200));
ELSE
Acceleration_Dst:=0;
END_IF;
IF Deceleration<>0 THEN
Deceleration_Dst:=(EXPT(Velocity,2))/(2*Deceleration*(1-Jerk_Percent/200));
ELSE
Deceleration_Dst:=0;
END_IF;
Constant_Dst:=(Distance-(Acceleration_Dst+Deceleration_Dst));
IF Tacc<>0 AND Jerk_Percent >0 THEN
Jerk:=(EXPT(Acceleration,2)/Velocity)*((200/Jerk_Percent)-1);
Jerk_GVL:=Jerk;
Jerk_Time:=(Acceleration-0)/Jerk;
Jerk_Time_GVL:=Jerk_Time;
ELSIF Tdec<>0 AND Jerk_Percent>0 THEN
Jerk:=(EXPT(Deceleration,2)/Velocity)*((200/Jerk_Percent)-1);
Jerk_Time:=(Deceleration-0)/Jerk;
ELSE
Jerk:=0;
Jerk_Time:=0;
END_IF;
Movement_Time:=Ttotal;
//NJ system only one jerk
JRound:=LREAL_TO_REAL(Jerk_Time);
IF (Tacc>Tdec) THEN
IF JRound>=Tdec THEN
Movement_Time_NJ:=Movement_Time+JRound;
ELSE
Movement_Time_NJ:=Movement_Time+(JRound/2);
END_IF;
ELSE
Movement_Time_NJ:=Movement_Time;
END_IF;
2. CALL initial and Final Value of Velocity, Acceleration, Deceleration, Jerk in
to Function Block
IF NOT xExecute THEN mStage:=0;END_IF
rStep:=0.01; //Put here your scanTime, if you wont you can put as input param
CASE mStage OF
0: //Initial Case
OutBusy:=FALSE;
OutDone:=FALSE;
IF xExecute THEN
CalcVelocity(Ttotal:= TTotal,Tacc:=TAcc , Tdec:=TDec , Distance:=
RelativeDist, Jerk_Percent:=JerkPercent ,
Velocity=> mVelOut,
Acceleration=> mAccOut,
Deceleration=> mDecOut,
Jerk=> mOutJerk,
Jerk_Time=> mOutJerkTime ,
Acceleration_Dst=> ,
Deceleration_Dst=> ,
Constant_Dst=> ,
Movement_Time=> );
mJerkAcc := mOutJerk;//The same Jerk For Acc and Dec
mJerkDec := mOutJerk;
mJerkTimeAcc := mOutJerkTime; //The same Jerk For Acc and Dec
mJerkTimeDec := mOutJerkTime;
rTime:=0;
rTend:= TTotal;
rTimeVelCnts:=rTend - (TAcc+ TDec);
rTimeDec:=0;
rTimeConst:=0;
rTimeAccConst:=0;
ProfileStage:=0;
accStage:=0;
decStage:=0;
OutPos:=0;
OutVel:=0;
//OutAcc:=0;
xkey:=TRUE;
mStage:=1;
END_IF
3. PLC CYCLE TIME Adaption
m_Time_In:=Rounded;
m_nScans:=m_Time_In/ScansSg;
m_IntScans:=LREAL_TO_DINT(m_nScans);
Rounded:=m_IntScans*ScansSg;
4. PART 1 OR PHASE 1 Calculation
1:
OutBusy:=TRUE;
IF xkey THEN
rTime:=rStep;
xkey:=FALSE;
END_IF
CASE (ProfileStage) OF
0: //Acc
IF (rTime < TAcc) THEN //AccStage
OutVel := OutVel + (OutAcc*rStep);
CASE (accStage) OF
0: //Phase 1
IF (rTime < mJerkTimeAcc)THEN
OutAcc := mJerkAcc * rTime;
ELSE
OutAcc := mAccOut;
IF(mJerkTimeAcc * 2.0 = TAcc) THEN
accStage :=2;
rTimeAccConst :=mJerkTimeAcc;
ELSE
accStage:=1;
END_IF;
END_IF;
5. PART 2 OR PHASE 2 Calculation
1: //Phase 2
rTimeAccConst:=TAcc - mJerkTimeAcc;
ScanAdapt(ScansSg:=rTimeAccConst , Rounded:=
rTimeAccConst);
IF (rTime>=rTimeAccConst) THEN
accStage:=2;
END_IF
6. PART 3 OR PHASE 3 Calculation
2: //Phase 3
OutAcc:=mAccOut -mJerkAcc*(rTime -
rTimeAccConst);
END_CASE
ELSE
OutAcc:=0;
IF (rTimeVelCnts <>0.0) THEN
//Cnst
ProfileStage := 1;
ELSE
//Dec
ProfileStage := 2;
END_IF
END_IF
7. PART 4 OR PHASE 4 Calculation
1://Cnst //Phase 4
IF (rTime >=(TAcc +rTimeVelCnts)-rStep) THEN
//Dec
ProfileStage := 2;
END_IF
8. PART 5 OR PHASE 5 Calculation
2: //Dec
rTimeDec:=rTimeDec + rStep;
ScanAdapt(ScansSg:=rTimeDec , Rounded:= rTimeDec);
OutVel:=OutVel + (OutAcc * rStep);
CASE (decStage) OF
0://Phase 5
IF(rTimeDec <mJerkTimeDec) THEN
OutAcc:= - mJerkDec * rTimeDec;
ELSE
OutAcc:=-mDecOut;
IF(mJerkTimeDec*2.0 = TDec) THEN
decStage:=2;
rTimeAccConst:=mJerkTimeDec;
ELSE
decStage:=1;
END_IF
END_IF
9. PART 6 OR PHASE 6 Calculation
1://Phase 6
rTimeAccConst: =TDec - mJerkTimeDec;
ScanAdapt(ScansSg:=rTimeAccConst , Rounded:=
rTimeAccConst);
OutAcc:=-mDecOut;
IF(rTimeDec>=rTimeAccConst) THEN
decStage:=2;
END_IF
10. PART 7 OR PHASE 7 Calculation
2://Phase 7
OutAcc:=-(mDecOut -mJerkDec *(rTimeDec
-rTimeAccConst));
END_CASE
END_CASE
OutPos:= OutPos +(OutVel*rStep);
11. END OF Calculation
IF rTime> rTend THEN
OutPos:=RelativeDist;
OutVel:=0;
OutAcc:=0;
OutBusy:=FALSE;
OutDone:=TRUE;
mstage:=2;
END_IF;
ScanAdapt(ScansSg:=rTime + rStep , Rounded:= rTime);
2:
OutDone:=TRUE;
END_CASE
12. CALL FAUNCTION BLOCK IN MAIN PROGRAM
13. ONLINE PROGRAM AND SEE DIFFERENT RESULT
RESULT1
RESULT2
RESULT3
14. APPLY THIS SOLUTION TO PLC BLOCK
View publication stats