S-Curve Profile for Motor Control Project

furkandqe

Member
Join Date
May 2023
Location
Istanbul
Posts
8
Hello everyone, this is my first question in this forum and I'm still learning about these matters. I apologize if I make any mistakes.

I am driving an asynchronous motor using an S7-1200 PLC and ATV32 Inverter. I am measuring the speed of the motor using an encoder. In my PLC program, I have written a PID control algorithm. I send the necessary frequency to the inverter with the PID output and can achieve control.

Now I want to provide speed and motion control with an s-curve profile. With the start position, end position, acceleration, and maximum speed information, can I create a profile and execute the motion by inputting the speed information into the PID I've created?

I would greatly appreciate your help. Thank you.
 
Take JRW's advice. Use any built in software that generates s curves. I know the S-1500 has it because we have tested it. It isn't that good but we have talked to Siemens and they said the PLC is supposed to work with a Siemens drive that actually does most of the work and is MUCH better suited for the task.

Don't try to go cheap on this.
Do not try to write s-curve software on your own. This should scare you.
https://deltamotion.com/peter/wxMaxima/Seg1234567.html
That is just one example. There are many. What happens if the move is short so the desired speed is never reached? What if the desired acceleration is never reached?
 
I would also take JRWs advice, far simpler and more rigorously tested that rolling your own.

However it is possible, I've made my own for use with Siemens PLCs and they've been operating machines around the world for 10+ years without issue. It all depends on the application an how advanced you need it to be.

A simple ramp function generator maybe all you need, but again, siemens has some prebuilt functions, that are easier and well documented.
 
A 1200 using the standard siemens motion control blocks is good enough for positioning with an S-Curve.

Granted the examples I've worked with are relatively slow moving applications, 100 m/min.

Again, horses for courses, all depends on what the OP needs it to do. Is it a slow moving object, or fast. What's the tolerance needed for positioning? 10mm, 1mm, 0.001mm
 
Firstly, thank you so much for your responses. I forgot to mention in the question, I do not want to use Technology Objects.

The main goal in my project is not to achieve a hundred percent accurate movement. I want to measure how successful the method I wrote myself is and evaluate the margin of error. In short, I will experiment with a few simple values and prepare a report on the results.
 
Originally posted by Peter Nachtwey:

This would not be so simple in ladder.

This would indeed suck in ladder. But it is probably at least approachable in SCL. You might want to break up some of the larger equations into smaller bites just to keep everything in the editor window.

I agree it is a big ask to build up a profiler at this level in a plc. But I have personally done sillier things so I say "Party on!!".

Keith
 
I tried something and got a result like the one in the picture. I created an s-curve with the function block. I sent the resulting position information to the PID position controller. As an output, I also fed the speed information to the PID speed controller. However, it doesn't fully perform the s-curve movement, it responds late to the position and settles late. What kind of inference can I make from this?

https://ibb.co/n076XsW
 
I tried something and got a result like the one in the picture. I created an s-curve with the function block. I sent the resulting position information to the PID position controller. As an output, I also fed the speed information to the PID speed controller. However, it doesn't fully perform the s-curve movement, it responds late to the position and settles late. What kind of inference can I make from this?

https://ibb.co/n076XsW


We need more information about the process.

I would guess that the bottom two traces (trends) are reference RPM (setpoint; SP), and measured RPM (rocess value; PV), which are the SP and PV inputs to the PID referred to in Post #1. So that is the speed information you refer to. Is that correct?

I would also guess that the top two traces are the position SP (generated S-curve), and the measured position PV, which are the SP and PV inputs to a second PID. Is that correct?

How does the position PID affect the PV to the speed PID?

Why does the s-curve drop to 0 at 20s? Does that drop affect the SP to the position PID?

  • If yes, then why does the measured position PV not follow that drop the generated s-curve?
  • If not, then why does the speed PID drop at that time?
 
I've solved the problem of the S-Curve falling to zero, it was due to a small error in the code. My current result graphs are as follows.

https://ibb.co/YbBVRj7

Your predictions about PID are correct. The first graph shows the values generated by the function I wrote. I input these values as the set point to the position PID. The OUT of this PID is shown in the third graph, and it's the set point for the speed PID. The second and fourth graphs are the position and RPM information I measured from the Encoder. My current problem is that when I want the S-Curve to go to 60 as the set position, as you can see in the second graph, it goes to approximately 110 instead.
 
My current problem is that when I want the S-Curve to go to 60 as the set position, as you can see in the second graph, it goes to approximately 110 instead.


Can the position PID send a negative value of the SP to the speed PID?

If the position PID does send a negative value of the SP to the speed PID, will the speed PID see the negative value, or does the speed PID clamp negative SP values to 0 (zero)?
 
Last edited:
P.S. you can attach those images here, look for the
attach.gif
icon along the top edge of the Advanced Editing/Posting tool.

I also suggest you make the images a bit smaller.
 
Is the speed PID SP and/or CV on a ramp i.e. does the process limit how fast speed SP input or speed CV output can change?
 

Similar Topics

Hi The pump smart PS220 VFD has the ability to estimate pump flow based of pump characteristics and measured motor data. The calculations...
Replies
12
Views
3,745
Hello all, I need to write a code for S-curve motion profiles (7 segments) to control speed of motor via PLC. however, I cannot find the...
Replies
78
Views
17,836
Does anyone know of an Add-On Inst. or PAX Block that can be used to develop a characteristic curve? I have a Variable Speed Pump with a Current...
Replies
13
Views
2,649
Hello Forum, I am developing a Pump Control System and one of the most important modes of operation, is to keep the Pump operating inside it's...
Replies
36
Views
15,000
How can I make a powerflex 750 follow a curve like this? Doesn't have to be this exact curve, just something similar.
Replies
7
Views
2,349
Back
Top Bottom