Sign in to follow this  
Followers 0
stud_wallz

S-Curve Position Control or PID

10 posts in this topic

I've got a project I'm working on and I just can't seem to wrap my head around the best approach to it. I'm hoping someone can lend me some insight. Here is the problem: I'm using a ControlLogix 1756-L61 controller with the ENET adapter talking to a PowerFlex 755 VFD drive, controlling a 25hp AC motor. I've got an encoder and brake on the back of the motor which gives me safe control over the motor. Externally I've got a "string pot" or potentiometer that gives me 0-10vdc feedback as to position. All that being said, this is what I want to do. I'm trying to control a lift (14,000 lbs) and move from the current position to its commanded new position, using the "string pot" to determine position I want to make that move in a smooth S-Curve, ramping the motor VFD reference frequency out of its current position up to full speed, then ramping down as it nears the commanded position. (kinda of like a crane or elevator movement and control) I can sure use help in writing the ladder logic to do that... Edited by stud_wallz
1 person likes this

Share this post


Link to post
Share on other sites
The easiest way I know of to do an S-Curve is to implement a simple function like this: f(t) = (3-2(t/a))*(t/a)^2 * 100 t = time a = accel (total ramp time in seconds) So for example, if the total ramp time you're looking for is 30 seconds, you would implement this function by using 30 for a, and you could just use a timer that counts up to 30 for t. Plug it into Excel and graph it. You'll see that it's a nice S-Curve that goes from 0 to 100 with an input of 0 to 30. Actually, just take a look at the attached spreadsheet, and it shows this more clearly. S-Curve.xls

Share this post


Link to post
Share on other sites
This looks great for creating an S-Curve, thank you... but how can I get this curve to relate to position, so that time is a variable based on current position and desired position... in other words take a snapshot of the current position (0VDC), then take a snapshot of commanded position (10VDC) then calculate the time window based on maximum time (15 seconds) to achieve the move... to create the S-Curve... then if I were do the same thing where we would again take a snapshot of the current position (5VDC), then take a snapshot of commanded position (7VDC) then calculate the time window based on maximum time roughly say a percentage of maximum time (for arguments sake 7 seconds) to achieve the move... to create the S-Curve... but the maximum speed should never be achieved because the distance between the current position (5VDC), and the commanded position (7VDC) is too short to get up to full speed of the motor... is this right or am I missing something?

Share this post


Link to post
Share on other sites
I was under the impression that the PF755 has positioning capabilities when used with an encoder and encoder card. If that is possible, you could use the positioning inherent to the drive but verify position with the Logix. I have not used this myself, but it may be worth looking into.

Share this post


Link to post
Share on other sites
Reading the above and seeing 7 ton under VFD control and only 10K potentiometer for position confirmation {my assumption is 10K} I hope you've got redundant end of travel limits to stop the VFD and engage the break when pot fails and hopefully before the lift pulls a Willy Wonka Elevator and shoots thru the roof. Just MHO.

Share this post


Link to post
Share on other sites
Rest assured its a category 4 safety system that monitoring all safety aspects... plenty of redundant safeties both mechanically as well as electronically... I didn't mention it because it was irrelevant to the controlling issue... I have dual string pots along with the encoder for position verification, in addition to 4 limit limit switches along travel... and a sliding counterweight box that moves as the load shifts to balance the load... its a pretty intelligent system...
1 person likes this

Share this post


Link to post
Share on other sites
If you have the Function Block or Structured Text editors installed for RSlogix 5000 there is a instruction for this it is the SCRV, S-Curve, under the Drive Instructions. Take a look at the help file and see if this is what you are looking for.

Share this post


Link to post
Share on other sites
I still don't understand. You've got an encoder on the motor. It gives you far higher resolution than any string pot and much better control. Close the loop in the drive itself. Put the drive in position mode and away you go. One nice feature for lifts in this drive is the torque proving function that even allows the drive to verify that the brake is working and if not, uses the drive itself for a soft letdown. There are three major reasons for doing this. First, encoders are much more reliable than string pots, no matter how many you have. When an encoder fails, the drive detects this immediately and you can stop the system immediately. And the resolution is at least a few kilocounts per revolution, and you are probably looking at several revolutions per cycle. Most people make the mistake of assuming that if I want to control the system with X resolution, that's what I need. However when it comes to motion control in order to have any accuracy at all in terms of torque and acceleration, you need roughly 10 times the resolution that you'd need just for position information. Second, the way to write code to close the loop in the PLC is that you have to write a motion controller. You have to write a trajectory calculator to determine where the drive should be moving towards. Then you have to implement speed and torque control to move the drive to the intended set points that are being generated by the trajectory calculation which usually consists of 2-4 cascaded PID loops all driving with the string pot in this case as an input and the trajectory calculation as an output. However, ALL of this code is already written. It's in the drive. And this is the major reason that you shouldn't bother doing what you are doing...because you are duplicating a fairly large programming effort when it's already developed and debugged for you. You merely have to set it up. Third, your control bandwidth will be much lower if you are relying on the PLC and string pot. Part of this is the resolution problem, and part of it will be the response speed. The drive will be able to control the system with sub-millisecond speed and direct control over torque and acceleration. By closing the loop in the PLC and using analog inputs off a string pot, your loop time delays and response speed are much slower. Not a good thing with a 7 ton lift, especially if it is intended to have a safety rating. About the only disadvantage of doing control in the drive is that your encoder is probably an incremental type so you don't have absolute position on power up or reset. But you can easily execute a "home" command using the string pots as a reference and then your problem is solved. Take it from me since I've actually done this once...it is not worth your time (and frustration) to write your own motion controller. If you don't believe me, Peter Nachtewey that frequents this forum will chime in on the same point, and he sells motion controllers for a living.
1 person likes this

Share this post


Link to post
Share on other sites
I agree with paulengr. That was why I posted what I did regarding the use of the drive's positioning capabilities. Use the switches and cables as verifications back to the plc, but let the drive do the hard part.

Share this post


Link to post
Share on other sites
I second using the encoder. The pot might be good enough to set the home position but after that I would use the encoder. I don't know what kind of point to point move commands the drive has but if has them you should try them. Usually you enter a command position, velocity, acceleration and deceleration and the motion controller works out all the math so it will move from 0 to 10 v ( what are these positions really? ) or 5 to 10 v automatically adjusting the speed. If you have to ask about the algorithms for generating s curves then you shouldn't try this on your own. Writing target generators is tricky stuff as well as requiring a fair knowledge of calculus. A good motion controller will have a few different commands that would work. We have a command called the Time Move Absolute where all you do is provide the destination and the time to get there and the motion controller works out a polynomial that will go from its current location to the destination is the desired time. Other people like to have definite controls on velocities and accelerations but then these must be modified each time if the move is always going to take 30 seconds.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0