You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old March 17th, 2019, 07:02 PM   #16
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
Cheeco, I have many more test cases I will get to tomorrow but if your target generator works you can make money by selling the target generator to companies that want to make a motion controller. This would be like Codesys selling the PLC ladder logic program to companies that want to have a PLC but don't have the resources to create their own ladder logic software.

I am impressed that you are doing this out of a passion just to know or to do it. Few have this passion. Passion is what separates the best from the very very good.

BTW, I used Mathcad to generate most of my formulas. Mathcad is old and obsolete but I have been using it for over 25 years so it is the devil I know, The example I provided above used wxMaxima. I also used Mathematica for the most difficult problems. What software did you use to generate the formulas?
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old March 18th, 2019, 05:34 PM   #17
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
I have test a few more cases including the toughest one with 6 equations and 6 unknowns that was used by Robert Lewis. We get the same answers.
Solving this last problem the way I did provides an explicit solution. It works but it is very complicated. You have opened my eyes a bit. I am going to try an iterative just to see if it works. The problem with iterative solutions is that they take time that I don't have in a motion controller where the calculation time must be relatively deterministic.

What could be improved?

What I realize is that I need to change my HMI. I need to add a time in the column for the cursor values. I had to go back to my Mathcad worksheet to do accurate comparisons because my HMI doesn't display time. I also need a way of placing the cursor at a specific time because my cursor resolution is pixel limited.


Cheeco should allow for different acceleration and deceleration rates. Often people want to decelerate slower than they accelerate.




Excellent Job!!!!
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old April 15th, 2019, 06:54 PM   #18
tandempace
Member
New Zealand

tandempace is offline
 
Join Date: Apr 2019
Location: Auckland
Posts: 1
calculate time from known Jerk, acceleration and Distance.

Peter, thanks for your useful formulas. They are easy to follow and very useful for an automation project we are working on.


I also want to be able to calculate the acceleration time when I know the initial velocity, given acceleration and Jerk and the distance traveled over this motion.


Thanks
Michael
  Reply With Quote
Old April 5th, 2020, 08:11 PM   #19
jast.313
Member
United States

jast.313 is offline
 
Join Date: Jul 2017
Location: California
Posts: 2
Quote:
Originally Posted by Peter Nachtwey View Post

Meanwhile, just so the people here know what it takes to do this will provide this link.https://deltamotion.com/peter/Maxima/Seg1234567.html
Even the simple case requires solving 17 equations for 17 unknowns! Try solving that in a PLC!

Good job!
Peter, I tried this link and see it requires a sign in. I would love to see the 17 equations. Any possibility to open this up?

Thanks,
Jas
directmotion.com
  Reply With Quote
Old April 5th, 2020, 09:52 PM   #20
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
I will have my IT guy check into it tomorrow.


BTW, we entered the same move into a S7-1500. The S7-1500 does not provide a jerk limited time optimal motion trajectory. I bet few motion controllers provide the optimal motion trajectory.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old April 7th, 2020, 05:33 AM   #21
userbeware
Member
Ireland

userbeware is offline
 
Join Date: Sep 2018
Location: Ireland
Posts: 14
Quote:
Originally Posted by jast.313 View Post
Peter, I tried this link and see it requires a sign in. I would love to see the 17 equations. Any possibility to open this up?

Thanks,
Jas
directmotion.com



Also interested in having a look at those EQ's if possible. Impressive work Cheeco, fair play.

Thanks!
  Reply With Quote
Old April 7th, 2020, 09:33 AM   #22
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
You should be able to click on the link and see the equations. There is nothing that fancy for a normal move. The problem is much more complicated if the move is so short that the commanded velocity and acceleration are not reached.


Normally there are 7 motion segments/states 1 to 7. Segment 0 is the stopped state.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon

Last edited by Peter Nachtwey; April 7th, 2020 at 09:37 AM.
  Reply With Quote
Old April 7th, 2020, 11:32 AM   #23
drbitboy
Lifetime Supporting Member
United States

drbitboy is online now
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 4,955
Hi Peter,


So the input parameters are
  • ||j||, the maximum jerk magnitude
  • ||a||, the maximum acceleration/deceleration magnitude
  • ||v||, the maximum speed
  • x7, x0, (or x7 = distance to cover, and assume x0 is zero)
  • v0, v7 (sometimes*, but not necessarily, both zero?)
  • a0, a7 (same case re: zero as v0, v7?)
And it solves for time (or times) and/or distance as a function of time.


Is that about right?


Thanks


* I changed the "usually" to "sometimes" - the [v0=v7=0] case, or not, is going to be application-dependent, I suspect.

Last edited by drbitboy; April 7th, 2020 at 11:46 AM. Reason: usually=>sometimes
  Reply With Quote
Old April 7th, 2020, 01:27 PM   #24
jast.313
Member
United States

jast.313 is offline
 
Join Date: Jul 2017
Location: California
Posts: 2
Peter, really great work you have done...

CNC requires an interesting feature "feed rate override" where the operator changes the programmed "v" at runtime, often in the middle of a move... this means "v" & "t0-t7" are not constant throughout the move (which changes x1,x2,x3,etc...)...
I believe this can also result in the segment state to 'go backwards' (ie: if t3<t<t4 and the operator doubles the "v", this could now mean t2<t<t3 or t1<t<t3)...

Very complicated. Have you have worked in situations like this?
  Reply With Quote
Old April 7th, 2020, 01:40 PM   #25
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
Quote:
Originally Posted by drbitboy View Post
Hi Peter,


So the input parameters are
  • ||j||, the maximum jerk magnitude
  • ||a||, the maximum acceleration/deceleration magnitude
  • ||v||, the maximum speed
  • x7, x0, (or x7 = distance to cover, and assume x0 is zero)
  • v0, v7 (sometimes*, but not necessarily, both zero?)
  • a0, a7 (same case re: zero as v0, v7?)
And it solves for time (or times) and/or distance as a function of time.


Is that about right?


Thanks


* I changed the "usually" to "sometimes" - the [v0=v7=0] case, or not, is going to be application-dependent, I suspect.
You are right. Usually v0=v7=a0=a7 for a point to point move but many times the user need to change something on-the-fly. In sawmill applications it it often necessary to change the final position , x7, while ramping down.


Any case that may arise must be handled correctly. My graphical program in post #6 is great for testing but I have another version without an interface that has tested 200 trillion, yes trillion, combinations of moves. At work we call this any PVA to any PVA. PVA = position, velocity and acceleration.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old April 7th, 2020, 02:03 PM   #26
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
Quote:
Originally Posted by jast.313 View Post
Peter, really great work you have done...

CNC requires an interesting feature "feed rate override" where the operator changes the programmed "v" at runtime, often in the middle of a move... this means "v" & "t0-t7" are not constant throughout the move (which changes x1,x2,x3,etc...)...
I believe this can also result in the segment state to 'go backwards' (ie: if t3<t<t4 and the operator doubles the "v", this could now mean t2<t<t3 or t1<t<t3)...

Very complicated. Have you have worked in situations like this?
Yes, a good controller can move from any PVA to any PVA efficiently. Look at post #6. In this example a command is issued to stop but the command decel limits the deceleration so the motion must overshoot and come back. This motion is NOT optimized. Look at time 1.32 seconds. At this time the motion has stopped and then starts accelerating back to the set point at 0,0,0. This is not optimal because the acceleration went to 0 too. This wastes time. You can see the gray line ( acceleration ) is negative until about time 1.23 and then the acceleration become less negative until it becomes zero at 1.32. We call this a ramp reverse. An optimal ramp reverse would keep the acceleration -100 during the slow down then continue back to down to -200 at about time 1.5 seconds. This would save perhaps a tenth of a second.


No one caught this. We I examine other controllers I have a few tests to I use to find non optimal movement.


So why does this matter? Say for instance you have a flying shear or cut off machine. After the cut is made the cutter needs to retract quickly get get read for the next cut. Saving a tenth of a second can mean a lot to production. On top of that, decelerating through 0 velocity reduces the distance traveled and saves energy.


Details, details.


For CNC type of motion we can change the feed speed on the fly. We can do this in 2 or 3 dimensions.

I have an example but I don't change the feed speed but that is the easy part.

https://deltamotion.com/peter/Maxima/feedspeed.html
A little calculus for those stuck at home like me.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old May 13th, 2022, 10:57 AM   #27
jeffersonhui
Member
United States

jeffersonhui is offline
 
Join Date: May 2022
Location: Minnesota
Posts: 2
Quote:
Originally Posted by Peter Nachtwey View Post
Yes, a good controller can move from any PVA to any PVA efficiently. Look at post #6. In this example a command is issued to stop but the command decel limits the deceleration so the motion must overshoot and come back. This motion is NOT optimized. Look at time 1.32 seconds. At this time the motion has stopped and then starts accelerating back to the set point at 0,0,0. This is not optimal because the acceleration went to 0 too. This wastes time. You can see the gray line ( acceleration ) is negative until about time 1.23 and then the acceleration become less negative until it becomes zero at 1.32. We call this a ramp reverse. An optimal ramp reverse would keep the acceleration -100 during the slow down then continue back to down to -200 at about time 1.5 seconds. This would save perhaps a tenth of a second.


No one caught this. We I examine other controllers I have a few tests to I use to find non optimal movement.


So why does this matter? Say for instance you have a flying shear or cut off machine. After the cut is made the cutter needs to retract quickly get get read for the next cut. Saving a tenth of a second can mean a lot to production. On top of that, decelerating through 0 velocity reduces the distance traveled and saves energy.


Details, details.


For CNC type of motion we can change the feed speed on the fly. We can do this in 2 or 3 dimensions.

I have an example but I don't change the feed speed but that is the easy part.

https://deltamotion.com/peter/Maxima/feedspeed.html
A little calculus for those stuck at home like me.
Hi, Peter,

Sorry to revive a 2-year old thread, but it looks like your Delta Motion links are broken now. Would you be able to fix them? I am having a hard time solving the 3rd order equations for jerk as well. I would like to see the equations that you solved for the S-curve motion profile, including this link:
https://deltamotion.com/peter/Maxima/Seg1234567.html
  Reply With Quote
Old May 13th, 2022, 04:06 PM   #28
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
Quote:
Originally Posted by jeffersonhui View Post
Hi, Peter,

Sorry to revive a 2-year old thread, but it looks like your Delta Motion links are broken now. Would you be able to fix them? I am having a hard time solving the 3rd order equations for jerk as well. I would like to see the equations that you solved for the S-curve motion profile, including this link:
https://deltamotion.com/peter/Maxima/Seg1234567.html
I renamed the directory
https://deltamotion.com/peter/wxMaxima/Seg1234567.html
However, that link does have much to do with 3rd order motion profiles. This one is better.
https://deltamotion.com/peter/wxMaxima/Seg1234567.html
Also, this thread covers a very difficult case. My example assumes that the acceleration and velocity limits are reached. The calculations get to be MUCH more difficult if the limits are not reached. As far as I know, Cheeco and I are the only ones that have solved it in a way that can be implemented in a motion controller. Solutions generated by Mathcad, Mathematica, and wxMaxima are too long to be useful.
Generating 3rd order motion profiles is not easy if trying to be optimal. I haven't seen another motion controller, that can solve the problem Cheeco presented, optimally.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old Yesterday, 09:38 AM   #29
jeffersonhui
Member
United States

jeffersonhui is offline
 
Join Date: May 2022
Location: Minnesota
Posts: 2
Hi, Peter,

Thanks for such a fast response.

I am trying to implement jerk control on a Codesys PLC, but don't know if it's even possible. I am currently getting an issue where the acceleration and velocity reach 0 together, but the position falls short of the setpoint due to rounding issues.

I don't think Codesys is equipped to handle matrices or solving many equations together so don't even know if I can implement your method...
  Reply With Quote
Old Yesterday, 01:04 PM   #30
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: United Welfare States of America
Posts: 7,844
Quote:
Originally Posted by jeffersonhui View Post
Hi, Peter,

Thanks for such a fast response.

I am trying to implement jerk control on a Codesys PLC, but don't know if it's even possible.
What do you mean by jerk control? The jerk is usually specified by the user. Codesys should implement the PLC Open motion libraries so you don't need to re-invent the wheel.



Quote:

I am currently getting an issue where the acceleration and velocity reach 0 together, but the position falls short of the setpoint due to rounding issues.
Yes, this can be a huge problem, but there are tricks.



Quote:
I don't think Codesys is equipped to handle matrices or solving many equations together so don't even know if I can implement your method...
You don't do this inside Codesys. I used Mathcad to figure out the formulas much like what you see in my link. I then implemented them in C so they could be made part of the firmware. You should try making a C library for Codesys if the PLC Open motion commands don't do what you want.



This is not an easy task.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Electronics Questions peavey_wolfgang_2000 LIVE PLC Questions And Answers 4 May 23rd, 2005 09:05 PM
How AB Timers work. PhilipW LIVE PLC Questions And Answers 0 January 28th, 2005 03:47 PM
1 input 3 outputs guest LIVE PLC Questions And Answers 26 February 8th, 2004 05:33 PM
Exact SP reached at end of heating ramp time JustDaveIII LIVE PLC Questions And Answers 12 October 17th, 2003 05:07 PM
lambda tuning – how is it calculated? Ron Beaufort LIVE PLC Questions And Answers 4 August 5th, 2003 12:45 PM


All times are GMT -4. The time now is 03:24 PM.


.