How to get PID Padameters for a "lowpass with integrator" process

Hello,
I want to realize a position control of an el. motor. To get information of the process I make a step experiment.
So I get the following model of the process:
F(s) = K1/(1+s*T1) for the speed and with the integrator K2/s the process has the transfer funktion
F(s) = (K1/(1+s*T1))*K2/s
The PID controller works with the frequency of 1KHz.
What I want is to determine the PID Parameters in the processor at runtime.
What approach do you sugggest. I got he advice to "Ackerman". I looked on the "Ackerman formula", but its not easy for me. I dont understand the whole context.
Who knows a approach or want to helt to come through the Ackermann formuls?
Best regards
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

This is the link to the pdf file I posted the last time. ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20t1p1%20pid%20cd.%20wolfgang.pdf I know I don't have much explanation about all the steps but the method works very well. Most people just want the formulas without knowing all the theory so I just provided the formula. You can buy books that explain the formula.
Here is a version written in Scilab ftp://ftp.deltacompsys.com/public/Scilab/Ackermann.sce You can play with the open loop system parameters and see how the gains change.
The whole idea is to 1. Find the system's open loop transfer function using system identification. Your system was easy enough to find the gain and time constant by inspection. 2. Determine where you want the poles to be. I usually just put them all on the negative real axis. This keeps the system stable even if the system changes a bit. The poles will not drift far. 3. Calculate the controller gains. I use two methods. Symbolic and Ackermann's method. The symbolic method assume the sample time is very fast. The advantage I have with symbolic gain calculations is that I can easily change the gains on-the-fly whereas the Ackermann's method requires a lot of matrix math as you can see.
What I think you need is to get the big picture. Here is some home work. Look at this website http://www.engin.umich.edu/group/ctm/PID/PID.html Read down to the point where it says "Proportional Control" . What is the value of Kp that will return a critically damped response? This should be easy.
When you have solved that then go to "Proportional-Derivative control" What should Kd be to get a crtically damped response when Kp=5, 16, 29 and 44. This should be easy too.
Now go to the "Proportional-Integral" control. Are there any values of Kp and Ki that will provide a critically damped response? Why or why not?
Do the same for the "Proportional-Integral-derivative" example. This one will take some work but when you get through it you will understand what the Ackermann formulas is doing for you. While solving problems like these I developed the formulas for calculating gains symbolically. I used a program called Mathcad to derive the symbolic solutions for the gains. There is another program called wxMaxima that is free that can solve these problems easily.
Let us know what you get. I am sure there are many that have the same questions and will work through this problem. I need to work through the last two myself. I don't remember the results I got. My objection to the CTM PID page is that it shows Matlab answers without understanding. This takes time and effort.
Peter Nachtwey.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Hello Peter, I did it. As the transferfunction has a damping, I can increase Kp very much, but it remains damped. The transferfunction has no zeros where the real-part is >= 0. Do you agree?
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Did you figure out how to place the poles by doing the 'home work'?
Did you find a method to calculate the gains? You should be able to solve for the PID gains symbolically.

As long as you increase the derivative gain to keep the system critically damped BUT reality limits how high you can increase the derivative gain. Sample jitter and sample quantizing non-linearities limit how high the derivative gain can be increased.

It better not. If it did the transfer function would have a non- minimum phase response.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Hello Peter,
I confused the denomination of "critical damped" with the unstable fall.
the characteristic Polynome is s^2 + 10s + 20 + Kp
the Poles of the Polynome are -5 +(-) SQR(5-Kp)
The System is critical damped, if the two poles are at same Place at the negative real axis.
So the system is critical damped with Kp = 5
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Wolfgang, your answer is correct for proportional only tuning. For PD tuning there are many more options as both Kp and Kd can be increased together. PID control allows the error to be driven to 0. What are the gains PID gains that will result in a critically damped response?
You should be able to solve for general symbolic formulas that will provide critically damped responses or any response for that matter. It takes about 10 lines of code in wxMaxima. It takes only a few minutes to work this out by hand.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 24 Feb 2009 14:04:14 -0800, pnachtwey wrote:
-- snip --

Unless you've been using WxMaxima for a bit too long :-)
--
http://www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I had to think about what you were trying to say before I finally got it. I think a system with 3 closed loop poles should be easy enough so that it is easier to solve for the symbolic gains by hand rather than try to figure out how to use wxMaxima for the first time. I didn't know you use wxMaxima. I like the new wxMaxima interface and have been using it more and more. wxMaxima is finally usable and allow multiple windows on a Mac but only one window on a PC.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 24 Feb 2009 21:20:42 -0800, pnachtwey wrote:

They got it right for Windows about the time I started using it, but made sure to leave the old-style WTHIT* interface for a bit on the Linux distributions.
At this point the only symbolic calculations I do by hand are either really easy, because it's not worth firing up WxMaxima or the like, or they're really hard, because WxMaxima can't cope.
* What The Heck Is This?
--
http://www.wescottdesign.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

1. At first to PD: I can calculate the poles by hand. But zhere are always yet the parameters Kp and Kd. They is no singular solution.
Naturaly you can make an approach for (s + lambda)^2 and verify the coefficients for the polynome s*s + (10+KD)*s + (20 + KP)
But then is the question how t set lambda to a good value.
2. PI and PID: The characteristic polynome is of the 3rd order. So I dont have a fast solution to calculate the poles. I need one pole to reduce it to a second order and then I can calculte the other two poles.
I see, for the PID you make also the aproach with (s + lambda)^3
But again: What is the reasonalble value for lambda?

What is your way by hand?

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

You break the problem down to three equations and three unknowns. The desired closed loop transfer function, desired CLTF(s)= K*lamda^3/(s+lamba)^3 so the deisred characteristic equation is: CEdesird=s^3+3*lambda*s^2+3*lambda^3+lamda^3 and and the actual closed loop CE is CEact=s^3+(10+Kd)*s^2+(20+Kp)*s+Ki Now there are three questions and three unknowns, one for each of the powers of s except the highest power.
Ki=lambda^3 Kp+20=3*lambda^2 Kp=3*lambda^2-20 Kd+10=3*lambda Kd=3*lambda-10
Holy %^$!, I could do that in my head!!!! That wasn't so hard even though I have been using Mathcad and wxMaxima for years!!!!
Now obviously we don't what any of the gains to be negative, for now. Therefore is must make sure that lambda is greater or equal to the sqrt (20/3) and greater or equal to than 10/3. If lambda is set to 2*PI that means gains will be positive but the response will be very slow as it takes about 9 lambda to get within %1 of a set point in response to a step change. The larger the lambda the faster the response as the poles move farther to the left on the negative real axis BUT there is a reality limit due to feed back resolution and unmodeled non- linearities.
/* CTM PID tuning Compute the symbolic formulas (%i1) remvalue(A0,A1,B1,%lambda,Ki,Kp,Kd)$ /* Undefine */ Gp: B0/(s^2+A1*s+A0); /* System transfer function */ Gc: Ki/s+Kp+Kd*s; /* Simple PID controller */ CLTF: ratsimp(Gc*Gp/(1+Gc*Gp)); /* Closed loop transfer function */ CE: expand(denom(ratsimp(CLTF))); /* Characteristic equation */ DIFCE: expand(CE-(s+%lambda)^3); Ki: solve(coeff(DIFCE,s,0),Ki); Kp: solve(coeff(DIFCE,s,1),Kp); Kd: solve(coeff(DIFCE,s,2),Kd); grind(Ki,Kp,Kd); (%o2) B0/(s*A1+A0+s^2) (%o3) Kd*s+Ki/s+Kp (%o4) ((Kd*s^2+Kp*s+Ki)*B0)/((Kd*s^2+Kp*s+Ki)*B0+s^2*A1+s*A0+s^3) (%o5) Kd*s^2*B0+Kp*s*B0+Ki*B0+s^2*A1+s*A0+s^3 (%o6) Kd*s^2*B0+Kp*s*B0+Ki*B0+s^2*A1+s*A0-3*%lambda*s^2-3*%lambda^2*s- %lambda^3 (%o7) [Ki=%lambda^3/B0] (%o8) [Kp=-(A0-3*%lambda^2)/B0] (%o9) [Kd=-(A1-3*%lambda)/B0] [Ki = %lambda^3/B0]$ [Kp = -(A0-3*%lambda^2)/B0]$ [Kd = -(A1-3*%lambda)/B0]$ (%o10) done
BTW, I have used the CTM PID page to show my engineers this for years. ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20T0C1-PID%20CTM%20NG.pdf
Now, you calculate the PID formulas for your motor system OLTF(s)=Gain*alpha/(s*(s+alpha)) BTW, don't be surprised if you have a gain in the denominator. The CTM PID example assumes K=1 so it disappears.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Okay - you always make the approach lambda^n/(s + lambda)^n for a characteristic polynome od degree n.

Ok - by that way Im not slower...

The time constant is 3/lambda. 9 lambda would increase the responsetime with increasing lambda.

Mathlab?
Ok, I will do this. I will look at the degree of the characteristic polynome and make the approach lambda^n/(s+lambda)^n
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I thought you had gone. Normally, a more general approach is to make the desired CE ((s+a) ^2+b^2)*(s+c). There is always one real pole on the negative real axis. You can adjust b to provide as much overshoot as you want or can tolerate. I usually don't tolerate any overshoot on a motion system so the simple multiple real pole solution works for me

I have done this before, many times.

What time constant? The closed loop time constant is 1/lambda. lambda is the location of the closed loop poles specified by a frequency in radians per second.

Increasing lambda makes the response faster because the closed loop pole locations are at a higher frequency. Increasing the lambda makes the closed loop time constants shorter.

This is wxMaxima. It is free. If you want answers uses Matlab or Scilab. If you want understanding then use wxMaxima, Mathcad, Maple or Mathematica. http://maxima.sourceforge.net/download.html wxMaxima, Mathcad, Maple or Mathematica makes doing symbolic math easier.

Yes, keep it simple at first. I think you are still confused. Download wxMaxima and play with variations. After a while you get the feel for how to place closed loop poles.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

The closed loop transfer function of your approach is:
TFCL = lambda^3/(s + lambda)^3
TLTF = lambda^3/[s^3 + 3*lambda*s^2 + 3* lambda^2 * s + lambda^3]
if I ignore the higher order of s I get the CLTF_approx
CLTF_approx = lamda^3/[3*lambda^2*s + lambda^3] = lamda^3/[lambda^3*((3/lambda)*s + 1] = 1/[(3/lambda)*s + 1]
So the time constant is 3/lambda.

Please read what you wrote above:
Part 1:"but the response will be very slow as it takes about 9 lambda to get within %1 of a set point in response to a step change"
If you write this, then the time to reach setpoint is growing with lambda! t_99% = 9* lambda !!!!
Part 2:"The larger the lambda the faster the response as the poles move farther to the left on the negative real axis"
Thats correct, but Part 1 is an antilogy to Part 1

Thank you for advice

So - now I have calculated the approach for my integrating process and for the low-pass-process.
At first : Integrating process with f(s) = k/{s*(1+s*T)]
I have scanned the approach:
http://www.loaditup.de/334114.html
With the right mouse button, you can save it.
To the result (at the bottom): 1)The system has a unique solution 2) If I want a control without D-Part, then lambda must be 1/(3*T) That means, with a PI controller, I cant vary lambda?!?!
At 2nd to the low-Pass-Process with f(s) ? k/(1+s*T)
reachable at
http://www.loaditup.de/334114.html
To the result:
1) I get only 2 equations for the 3 unknowns (Kp, Ki, Kd) 2) I set K to any value and calculate with the 2 equations Ki and Kd
How do you think about it?
Best regards
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Wolfgang wrote:
...

So TFCL = TLTF? Doesn't s^3 + 3*lambda*s^2 + 3*lambda^2*s + lambda^3 (s + lambda)^3?
...
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yes but what is TLTF? Not closed loop, not open loop, not desired What does TL stand for? Is TL a German abbreviation for something? I didn't see where TLTF was used.
I hope I am not confusing anybody. I often use CE for characteristic equation and TF for transfer function. OL for open loop and CL for closed loop. Mathcad lets me use subsripts but I can't do that here or in Scilab.
Peter Nachtwey
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Hello,
TLTF was a writing error of me. Obviously TFCL (Transfer Function Closed Loop) is correct.
Peter - You dont and didnt confuse anybody ;-))
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hello Peter,
I must "go back" to the measurement to determine the process parameters. You can see an measurement of the step respone at http://www.loaditup.de/345637.html
If you look at the sheet, you can see the step response of the motor with a inertia load (v-max = 19200) and with additional braking (v-max = 11000) This was the basics to suppose its a first order process (K/(1+p*T)
But now look at the impuse respone: http://www.loaditup.de/345634.html
The curve with the green rhombus has the same input strength as the step. While the impulse its the same curve as at the step with v-max 19200).
But at the impulse end, the current is set to zero and you see the speed is decreasing linear. its really not a first order behaviour.
And if I reduse the Impulse duration to the half (curve with black circles) you see, that the response reaches in at the half time the state zero.
This is no first order behaviour. Both Impulses were significant shorter as the time constant, so they should reach zero araound at the same time.
If you look at http://www.loaditup.de/345636.html you can see the motor modell. The motor is a FOC stepper motor. The currents/voltages are sinusodial, but if you use instead the RMS- values, the model is the same like a dc motor with permanent magnets.
Look at first at Point II of the model: there ist the model with voltage input and speed output. The first element is a first order type for the rotor-current (stator current at the stepper). It has a very low time constant TA, which could be set to zero for this discussion. The current produces a drive moment (me). Of this driving moment the load is subtracted. The difference is the effective moment to the inertia, which is modelled as the integrator element with the time constant TI. Because the EMK of the motor, there is a feedback to the input voltage UA, where the EMK-part is subtracted. This model describes the motor which has a voltage as input. But the control of the motor has a current control. I medelled it at Point I. There you see, that the actual current is feedback and verified with the setpoint current. The current controller is drawn by the blanc element. It outputs the voltage UA in a way, that the requested current flows.
Now to the impulse behaviour: The input is the current. Its set to a certain value. This current produces a driving moment, where the load moment is subtracted and the difference accelerates the inertia. The motor speeds up as you can see at the diagram. At the end of the impulse the current is set to zero. Look at the modell. Zero current is reached, if the Voltage UA is at the same level as the feedback EMK. Thus, the drive moment is zero and the mechanical load is subtracted. The negative moment decellerates the inertia. If the load moment is constant (not speed dependend), the speed falls linear. This is exact, what you see at the impulse diagram at the falling section. But this is really no first order behaviour.
The consquence is, that I cant determine the first order model parameters by the impulse evaluation. The problem is, that I should have a solution which needs less turns of the motor, because if the motor is in the machine installed, you cant presume that the motor can run to get the parameters by the step response.
Do you know a solution to get the parameters with less space?
Regards
Wolfgang
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

The graphs make sense but is v-max the maximum velocity?. Counts/sec, mm/sec, rads/sec

This is a typical way motor systems excite their systems. The decreasing velocity doesn't appear to be exponential. This is odd. Are you sure you have any frictional loads removed?

I don't understand this statement. The green squares should be with 1% of 0 5 time constants from 120 ms. The black circles should be with 1% 5 time constants from 60 ms when the current is set to 0. Are you sure the graph doesn't have an offset?

But don't you have a load that makes the system time constant much longer?

Drive monemt == torque?. The Net Torque is divided by the inertia to get angular acceleration. I don't know what you mean by subtracted. The key is the Net Torque. The net torque is the torque caused by the current minus and frictional torque.

Do you have a current source?

Check out what I said above.

It is still hard to understand what you are saying. I understand the drive torque goes to 0 when the current goes to 0 and the system will coast to a stop depending on the damping and the static frictional torque.

The method you are trying to use is common. The way you do this is simple. You need to know 3 things: 1. The time it takes to get to the peak speed. In this case it is either 60 or 120 millis3econds. 2. You can tell from the graph how long it takes for the speed to drop to within 1% of 0. 3. You need to get the peak speed from the graph. If you know how long 5 time constants is then you can calculate how many time constants the rise time is. If you know how many time constants it takes get to the peak speed on the graph then you can calulcate what maximum speed the motor would eventuall reach at full speed.

Yes, it is common for the ramp down to take a long time and possibly go too far when opeating in current mode. Without negative current there is no way of stopping except for friction. What I do a postive pulse and then a negative pulse of the same duration. The negative pulse stops the motor faster.
I will see if I have time to show an actual example. I have a motor that has a time constant of about 1 second that runs in torque mode. I don't like methods that depend on just a few readings. Everything depends on just a few points.
Peter Nachtwey
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

8192 at the diagram is equivalent to 1000 rpm

At all graphs the motor was mounted to a brake. At the green rhombus line/black circe line (impulse 120ms/60ms; 0V at brake -> no braking force) the motor has to drive approx. only the inertia load.
At the red circle line/blue cross line (impulse 120ms/60ms; 5V at brake -> braking torque is active) the motor has to drive the inertia load and the constant braking torque.
So at the green/black marked line there may be only a little parasitic braking torque.

Its sometimes hard to explain complex themes only by written words. I will say it with other words.
1. The difference of green and the black curve is the impulse duration: 120ms at the green one and 60ms at the black one. 2. While the impulse is present, the accelleration is the same as at the step experiment, where the motor speeds up to 19200. 3. At the step experiment we saw, that the time constant T is about 1s. 4. Back to the impulse: So while the impulse is present, the speed rises in a "linear" way, because 120ms are less T (=1s). That is ok 5. Now we look at the behaviour after the impulse. The motor current is reduced to 0. If the process now has furthermore a first order character, the speed must not fall linear. At first, the gradient must be strong and later the gradient reaches about zero. And: Independent of the starting value, after 5 times T the speed must reach about zero. But look at the impulse response after the impulse finished: The green and black line falls nearly linear. And because they falls linear, the green line needs more time after impulse finish to reach 0 as the black line. At a first order system, the time to reach "0" must be constant independent of the signal high. Furthermore the green line needs significant less as 5*T to reach zero. That means: At the whole step experiment or at the impulse experiment while the impulse is present, a first order behaviour is viewable. But at the impulse experiment after the impulse, the behaviour is not like a first order system.
And there I ask myself, if I determine the PID-Parameters with the behaviour ot the step experiment, get I than the correct parameters, if the behaviour at the impulse experiment (after finishing the impulse) is not a foirst order behaviour?

Look at ma modell: The first element (1/1+p*TA) is the modelled first order behaviour of the current. This time constant is very less (about 1ms) and has no importance for this discussion. The inertia mass is part of the Integrator 1/(p*TI) and determines the value of TI. If TA is much less than TI then the transfer function between the voltage us and the speed n (look at the modell at point II) is 1/(1+pTI). that means that the behaviour of a voltage controlled motor is like a first order system and the time constant TI is determined by the mass inertia.

Yes
Yes. We mean nearly the same. The current produces an electrical torque. Now think at the motor axis is a wheel with a wraped rope ant at the rope is fixed a weight. This produces a load torque. If you define, that if the load torque works against the electrical torque, the load torque has a positive value and if the load torque works in the same way like the electrical, the torque load has a negative value, than you must subtract the load torque from the electrical torque to get the effective torque. If you have an additional friction, this value must further also be subtracted. ANd the effective rest is your net torque.
Think about: You have a electrical torque from the current (which can also be zero), you have a mechanical load torque as by the wheel with weight (which can be zero) and you have a torque by friction (which can be zero and speed dep.) This three torque types are different and all must be considdered. That is done by my subtraction.

The motor is controlled by a Allegro A3985 motor driver. And the input value of this IC is the current.

What I want to say: At the step experiment - the input is the current which is set to a fix value, the output is the speed - I see a first order process behaviour. At the impulse experiment, if I look at the decreasing speed - I see no! first order behaviour. I understand the behaviour if I look to the drawn modell. And what does this circumstance mean for determining my PID- Parameters. If I determine the process-parameters with the step experiment, I can determine the PID-Parameters. But will fit this PID parameters, because if I look at the impulse experiment after finishing the impulse, I dont see the behaviour of a first order process.

Thats the point: this time depends of the peak speed. At a real first order process, this time is constant, independent of the peak speed! And therefor I cant determine a reasonable time constant with the impulse experiment. Evaluating the impulse respone I never come to the time constant of 1s as by the step experiment!

It would be very interesting: If you input a current impulse - I believe you will have the same bahaviour (if you input a regulated fix current for the impulse, not a fix voltage).

Yes - you are right - but for me its now importand to principile of the whole. I know that a method which is based on an integral behaviour is much stable as one which evaluates a few points of a response.
Wolfgang Weinmann
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.