PID Tuning tool

I didn't account for the Coriolis effect, oh my.

As well as the influence of stars, planets and asteroids, and certainly you forget account the expansion of the universe :)

I think you understand what I am talking about. We can only say that we have an LDE (or something), witch response to some influence (change setpoint, disturbance) differs from the response of the plant to some SSE (or something). And this is correct for some range of the plant states.
 
The models don't need to be linear. That is the whole point of using differential equations. Also, the non-linear valve identification isn't perfect but the means squared error is a mere 0.000031. 0.000031 is the averaged SSE for one point in time for 15 parameters. Again, the models don't need to be perfect, just close. If my model can correctly estimate the control output within 2% of the actual required, then the closed loop control only needs to correct for that last 2% instead of trying to generate the whole 100% on its own. This reduces the error and response significantly because the closed loop control only generates an output when there is an error. Feed forwards are basically the inverse of the model and generate an output in response to changes in the SP, SP' and SP'' before the error accumulates in a significant way.

https://deltamotion.com/peter/Videos/AutoTuneTest2.mp4

Here is yet another example where I am tuning a small 200W motor in torque mode. The disc has enough weight so the time constant for the motor and load is about 1 second which is slow. This is an old video where I was really testing the picture in picture feature of the screen recording software. Notice the excitation is much different in torque mode than what it would be for velocity mode. Also, you can see I move a slider up to change the bandwidth. What that is doing is moving the closed loop poles farther to the left ( more negative ) in the s-plane.
Notice also that the feed forwards don't change as they are a function of the model, not the bandwidth. Finally the mean squared error is on the order of 10^-7.

The green line is the control output +/- 10 volts. This gets converted to current by the amplifier.
The cyan ( light blue ) line is the target position. It is using 5th order ramps.
The red line is the actual position read from the encoder.
You can see at first the actual position does not follow the target position well at all. After tuning the actual position follows the target position almost perfectly. Also, notice that the control output look much different that what you normally would see. The control output is proportional the target acceleration. You can see that when the acceleration is negative the control output is negative. Many so called "auto tuners" just use a few points after making a small pulse. We use the thousands of points recorded. This results in a much more accurate model that isn't as dependent on just 3 readings that are limited by sampling rate, sample jitter and resolution.
 
As well as the influence of stars, planets and asteroids, and certainly you forget account the expansion of the universe :)

I think you understand what I am talking about. We can only say that we have an LDE (or something), witch response to some influence (change setpoint, disturbance) differs from the response of the plant to some SSE (or something). And this is correct for some range of the plant states.

That's the idea behind the Adaptive Tuner, it will update the PID gains depending on the current system model. And you can update the system model as often as needed.
As opposed to the static tune from an Open Loop step test, which works off a single model.
 
Here is yet another example where I am tuning a small 200W motor in torque mode.

At this example:

The green curve is CO.
The brown curve is PV.
The model used at this example is
(CO/PV) = G(s) = k/(T*s+1) = 600/(2.5237*s+1)

Am I right?

PID-controller represented like this?

Gc(s) = kp*(1 + 1/(ki*s) + kd*s) = 1213 *(1 + 1/(39660*s) + 12.35*s)
 
At this example:

The green curve is CO.
The brown curve is PV.
The model used at this example is
(CO/PV) = G(s) = k/(T*s+1) = 600/(2.5237*s+1)

Am I right?
The PV or target position should be red.
Otherwise you are correct, the mass of the wheel makes the time constant due to the inertia of the wheel and motor very long by design.


PID-controller represented like this?

Gc(s) = kp*(1 + 1/(ki*s) + kd*s) = 1213 *(1 + 1/(39660*s) + 12.35*s)
No! I don't know of any motion controller that uses dependent gains.
Gc(s) = Ki/s+Kp+Kd*s
Ki=39660 %output per error unit-second
Kp=1213 %output per error unit
Kd=12.35 %output per ( error unit/second)
An error unit is 1/1000 of a turn
Don't ignored the feed forwards! Feed forwards are extremely important.
Notice that the feed forwards are a function of the open loop model, not where the closed loop poles are placed.
 
The PV or target position should be red.
Otherwise you are correct, the mass of the wheel makes the time constant due to the inertia of the wheel and motor very long by design.

To avoid misunderstanding

Are the CO and PV curves marked correctly in the picture?

And it’s Transfer function is:
(CO/PV) = G(s) = k/(T*s+1) = 600/(2.5237*s+1)

Correct?

motor.jpg
 
Yes, for the open loop velocity model as a function of control output.

However, in the video I am controlling position so the velocity must be integrated to yield position. So the open loop position model should be


Code:
 600/(s(2.5237*s+1))


Notice the extra s in the denominator. The extra s integrates velocity to position.
Since the open loop transfer function has two poles, two gains are required not counting the integrator. This is why a PID controller is required. Remember the integrator doesn't count because it adds its own pole. This motor is not controllable without the derivative gain.

Your assumptions about the lines are correct. You cut off the legend in the lower left of the video. The legend is where the colors are identified.
In motion controller we use the terms target and actual position.
 
Last edited:
However, in the video I am controlling position so the velocity must be integrated to yield position. So the open loop position model should be

Code:
 600/(s(2.5237*s+1))

I've attached block diagram of separately excited DC motor with armature control.
I don't know the exact circuitry of your amplifier, but I think it also has a some order transfer function.
So I think actual model is little bit more complicated

The green line is the control output +/- 10 volts. This gets converted to current by the amplifier.
Ba-dum-tss

The amplifier "converts" the control signal into voltage pulses.
Voltage gets converted to current by motor armature.
Ia = (Va - Eb)/Ra

Finally the mean squared error is on the order of 10^-7.

In other words:

We can only say that we have an LDE (or something), witch response to some influence (change setpoint, disturbance) differs from the response of the plant to some SSE (or something). And this is correct for some range of the plant states.


All in all. What was the reason to show me this movie?
Do you think I don't know that 99% for PID-tuning use simplified models?
Do you think I do not know that in 99% of cases the result is acceptable?
But tell me this. In what percentage of cases, after the drift of plant parameters and the subsequent crash of the system, does the tuner scream that the PID controller has gone crazy because he (tuner) tuned it for an "accurate model" and "it was working good" but something mysterious happened?

Block_diagram_of_separtely_excited_DC_motor.png
 
As opposed to the static tune from an Open Loop step test, which works off a single model.
Anything that can be misunderstood will be misunderstood. If something simply cannot be misunderstood, it will anyway.



That's the idea behind the Adaptive Tuner, it will update the PID gains depending on the current system model. And you can update the system model as often as needed.

OK. Do it. Data attached.
 
I've attached block diagram of separately excited DC motor with armature control.
I don't know the exact circuitry of your amplifier, but I think it also has a some order transfer function.
So I think actual model is little bit more complicated
Yes, it is probably more complicated, I don't think my model is exactly right. Accelerations should be integrated twice to get position, not once. However, the delay is so small it can be assumed to be zero. I have no documentation on the motor and the amplifier. When I go into the field the customer doesn't either so I must rely on making a model.

Ba-dum-tss
????

The amplifier "converts" the control signal into voltage pulses.
Voltage gets converted to current by motor armature.
Ia = (Va - Eb)/Ra
You are trying to model what is inside the amplifier when there is no documentation or feed back.

In other words:

We can only say that we have an LDE (or something), witch response to some influence (change setpoint, disturbance) differs from the response of the plant to some SSE (or something). And this is correct for some range of the plant states.
Actually a couple of linear differential equations. One for velocity and another to integrator velocity to position.

All in all. What was the reason to show me this movie?
Do you think I don't know that 99% for PID-tuning use simplified models?
Actually, no. Your examples in the past have been for non-integrating systems.



Do you think I do not know that in 99% of cases the result is acceptable?
So why did you complain about models not being accurate above?



But tell me this. In what percentage of cases, after the drift of plant parameters and the subsequent crash of the system,
Why should this happen? I have a video where I use this to tune a 250 HP rotary clipper. It has been working for 16 years now.



does the tuner scream that the PID controller has gone crazy because he (tuner) tuned it for an "accurate model" and "it was working good" but something mysterious happened?
No, the tuner isn't always on-line and doesn't scream.



BTW, your diagram is wrong. The feed back is position and should come from after the 1/s because the feed back is position, not velocity. The reference should be a target position that is compared with the feed back or actual position.
The target position should be differentiated once to get the target velocity. The target velocity is multiplied by the velocity feed forward and summed after the PID ( where is the PID? ). The target position is differentiated twice to get the target acceleration. The target acceleration is multiplied by the the acceleration feed forward and summed with the PID and velocity feed forwards. This value goes to the amplifier.
We don't know what is happening after that. There is no feedback from inside the amplifier. If there was then we could implement an inner loop but the only feed back is the encoder position.


If you look carefully at the video you can see values for the PID and the two feed forwards when I move the slider up. The slider is placing the closed loop poles on the negative real axis is the s domain. As I move the slider bar up it is effectively moving the closed loop poles to the left. This makes errors decrease faster. Keeping the closed loop poles on or close to the negative real axis also avoids or minimizes over shoot. Also, if the plant parameters should change, the closed loop poles will still be close to the negative real axis and far from the origin so the system remains stable. I do tests for this by randomizing the plant parameters with a standard deviation of 10% and check the responses. This means a parameter has a 1% chance of changing by 30%. My models are never off this much.
 
BTW, your diagram is wrong.

It is diagram of separately excited DC motor with armature control NOT control loop

You are trying to model what is inside the amplifier when there is no documentation or feed back.

The most common brushed DC motor control method is Pulse Width Modulation (PWM)

Actually, no. Your examples in the past have been for non-integrating systems.

Didn't get it

So why did you complain about models not being accurate above?

Why do you change the target position so smoothly? (parts of curves in red circles)

MotorTargetPosition.png
 
It is diagram of separately excited DC motor with armature control NOT control loop
OK, here is a more detailed model. The example was originally a Matlab example at the University of Michigan. I didn't like their example so I used their data and showed how to do it right.
https://deltamotion.com/peter/Mathcad/Mathcad - DC Motor Velocity.pdf
I started just controlling velocity. The I turned the velocity loop into the inner loop and added a position loop.
I posted this on LinkedIn years ago when the topic was the ratio of inner loop to outer loop bandwidth. They were saying it must be 10 to 1. I proved that for the data given is was 3.32 to one for optimal performance.

The most common brushed DC motor control method is Pulse Width Modulation (PWM)
Yes, but the example above is analog.

Didn't get it
Velocity and temperature control systems are non-integrating or type 0 systems. Some people call them self regulating. Non-integrating systems will return a ambient or steady state when power is turned off. Velocity systems coast to 0 speed. Temperature systems cool down or warm up to ambient temperature.

Position and level control systems are integrating systems. Position control system integrate velocity. When power is off the position does not reset back to the beginning, the position ends up where the velocity reaches a zero speed.
Tank control level integrate the difference between the inflow and the outflow. The "gain" is the 1/surface_area of the tank.

Why do you change the target position so smoothly? (parts of curves in red circles)
I used 5th order polynomials for ramping up and ramping down. I have researched many ramping methods. The simplest is linear ramps but they required an instant change in acceleration which is not physically possible. I have tried 7th order polynomials. I think 7th order polynomials should be a option but 5th order polynomials are the best compromise. The problem with 7th order polynomials that the peak acceleration is 1.875 times the average acceleration. The peak acceleration is only 1.5 times the average acceleration.
In other words, to accelerate to the same speed in the same time the 7th order polynomial requires a higher peak acceleration which might be hard to achieve.
I have done many tests comparing different types of ramps. They all have their pluses and minuses like complexity. Even 3rd order ramp problems can be extremely difficult to solve. There is a thread about that a few years ago. Search for the user name cheeco.
 
The modeling is very good, but at the bottom there are derivative time constants calculated but only PI selected at the bottom. Hopefully you didn't ignore the derivative term when making your SOPDT graphs.

I don't see why the FOPDT have derivative time constants.

The SOPDT responses should be MUCH better than the FOPDT responses. It doesn't look like this is the case.

@everyone, can you see the model is MUCH smoother than the actual data. It is easier and more accurate to take the derivative from the model than it is from using the actual data.
 
The modeling is very good, but at the bottom there are derivative time constants calculated but only PI selected at the bottom. Hopefully you didn't ignore the derivative term when making your SOPDT graphs.

I don't see why the FOPDT have derivative time constants.

There are rule based gains, and then I have a selector that allows for optimisation of the gains for PI or PID. Also it can optimise between Overshoot or Minimum ITAE, and whether you want PvT or not.

The SOPDT responses should be MUCH better than the FOPDT responses. It doesn't look like this is the case.

The FOPDT gains are plotted against the simulated FOPDT model and vice versa so it's a perfect world scenario.

Whereas in reality the SOPDT will be a closer representation and will preform better, and does when tested.
 

Similar Topics

http://www.pas.com/tunewizard I've been using this a lot lately, used to cost $10k but now it is free (hoping you will pay for support or buy...
Replies
15
Views
10,925
Hello, I am attempting to tune a PID loop on a process. The process involves a valve with electronic actuator that has quite a high deadband...
Replies
10
Views
2,072
so i have 4 25gpm wells feeding a 1000gal tank (T-1), with an additional 15gpm from a decant tank for 3hrs every 12hrs. P1 and P2 both controlled...
Replies
154
Views
35,518
Hi everyone, yet another PID problem. I'm hoping I understand enough of the process I'm controlling that my request for help is reasonable. If a...
Replies
113
Views
27,613
I haven't had to tune a PID loop in a very long time. It's actually a PI loop for a pulse width modulation s.v. What was the name of that tuning...
Replies
16
Views
4,073
Back
Top Bottom