# Steady state error of PI current motor control

#### sebastian-online

Joined Sep 22, 2017
5
Hello everyone,

if you look inside books for a motor control, you will find always control circuits with a PI-current control. It does not really make sense to me, because it means that you have always a steady-state error if you do not compensate the back-emf voltage somehow.

A simple example:
The motor (dc-motor or non-salient synchronous motor in q-reference system) can be modelled as:
Vin = (L*s+R)*I+K_v*K_m*I/(J*s)
L:=motor inductance
R:= winding resistance
K_m:=factor Torque/Current
K_v:=factor (Back-emf voltage)/speed
J:=inertia
s:=Laplacian variable
Vin:=Input voltage (Uq)
I:=current

It results in the following system:
G(s) = I/Vin=J*s/((L*s+R)*(J*s)+K_m*K_v)

The PI-controller has the function:
K(s)=K_p*(1+K_i/s)

The closed-loop transfer function is:
T(s)=K(s)*G(s)/(1+K(s)*G(s))

It results in a closed-loop bode plot and step function as attached.

Why is the steady-state error disregarded? How is it done in professional inverter systems?

Note: Friction is disregarded in this case. If you consider friction, you will shift the zero in the open-loop transfer function. But sometimes friction is very small and can be disregarded. Is it maybe a problem for this kind of modelling?

Sebastian

#### WBahn

Joined Mar 31, 2012
30,076
How can you have a non-zero steady state error with an active integral term in the controller? Any non-zero error will build up the drive signal until it is large enough to reduce the error.

#### sebastian-online

Joined Sep 22, 2017
5
A PI-controller does not control always the steady-state error to zero and this is here the case. You have a derivative "s" in the nominator of G(s). It means basically that a simple PI-controller does not do it properly. And this is also my question: Why are they using a PI-controller for this case?

#### WBahn

Joined Mar 31, 2012
30,076
How can the derivative of the error affect the steady state error when, by definition, the derivative of the error in steady state is zero (if it isn't, then you are not in steady state)?

Again, explain the mechanism by which a PI-controlled system can exhibit a non-zero steady state error without the integral term increasing the drive strength until the error is driven to zero.

#### MrAl

Joined Jun 17, 2014
11,494
Hi,

Are you looking to control the speed?

Are you trying to use the measurement of the back emf to control the motor?

#### avayan

Joined Oct 30, 2015
38
Man, that looks like a lot of math. In real life, all we do is check the current across a SENSE resistor and then regulate it to a command. For example, if you want 1A across your motor, then we adjust the H Bridge PWM duty cycle until that value is read across the SENSE mechanism.

Do note this can also get hairy in all sorts of different ways. Because you have an inductive load and a current chopper, when you measure the current might be important. Like depicted by your equations above, the motor inductance, the application voltage, the motor's BEMF, the applied load, etc, will play a role in what kind of discharge rate you will see for the respective period. So, if you measure the current at the beginning of the cycle, or at the end, you may be regulating to something else.

Which most times is not really a problem because there is another loop being used to regulate what you truly want to regulate. Most often this is either position, speed or applied torque. That PI loop is the one which will drive the current loop. If the current loop magnitude is slightly off, the other loop will compensate accordingly.

#### sebastian-online

Joined Sep 22, 2017
5
@avayan: Thank you very much for your very good answer. One question: In some inverters it is possible to control the torque (for e.g. load simulation). Is there another loop around the current loop? I think it does not really make sense for a non-salient machine. Q-Current is proportional to the torque. So I would just take the current loop and calculate the reference value with K_m. But then you have still the steady-state error.

@MrAl: I want to control the torque / current.

@WBahn: It is simply control theory. You can proof it mathematically.
Lim t->infinity T(t) = lim s->0 sT(s) is a constant and not zero

#### WBahn

Joined Mar 31, 2012
30,076
@avayan: Thank you very much for your very good answer. One question: In some inverters it is possible to control the torque (for e.g. load simulation). Is there another loop around the current loop? I think it does not really make sense for a non-salient machine. Q-Current is proportional to the torque. So I would just take the current loop and calculate the reference value with K_m. But then you have still the steady-state error.

@MrAl: I want to control the torque / current.

@WBahn: It is simply control theory. You can proof it mathematically.
Lim t->infinity T(t) = lim s->0 sT(s) is a constant and not zero
What is the integral of any non-zero constant from t=0 to t=oo?

#### MrAl

Joined Jun 17, 2014
11,494
@avayan: Thank you very much for your very good answer. One question: In some inverters it is possible to control the torque (for e.g. load simulation). Is there another loop around the current loop? I think it does not really make sense for a non-salient machine. Q-Current is proportional to the torque. So I would just take the current loop and calculate the reference value with K_m. But then you have still the steady-state error.

@MrAl: I want to control the torque / current.

@WBahn: It is simply control theory. You can proof it mathematically.
Lim t->infinity T(t) = lim s->0 sT(s) is a constant and not zero

Hello again,

Do you think you can draw a nice block diagram? This would help understand your situation better as there are different ways to connect these systems and i dont want to assume anything at this point. If we can see a block diagram we should be able to explain any of these questions.

I think i understand your question but i want to be sure. For example, why not just use an integral control alone right? It is probably related to the speed of response of the system where the trade off is imperfect integral control sacrificed for faster speed of response, but i wont assume anything just yet. Integral controls can be slow so other schemes are often added to speed things up and often this will be the simplest, cheapest way to get some compromise, so there could be some drawbacks.

Last edited:

#### sebastian-online

Joined Sep 22, 2017
5
Hello again,

@MrAl: You find the block diagram here:

Integral control alone would not be enough to eliminate the steady-state error as you can see above in the step response. I would use a more advanced control like forward feed control to eliminate this effect.

@WBahn: It is really nice of you that you try to help me. Everyone knows that the integral of a constant over t=0...infinity is infinity. But this is not the point. If a PI-controller really eliminated all the effects then everyone would only use PI-controllers. But this is not the case as you can see in the step response in my first posting. Sometimes other controllers (not only P or PID) are better.

My question is still why one PI controller is used frequently even for torque control.

Moderators not: removed unnessesary whtite space

Last edited by a moderator:

#### MrAl

Joined Jun 17, 2014
11,494
Hello again,

@MrAl: You find the block diagram here:
View attachment 135703
Integral control alone would not be enough to eliminate the steady-state error as you can see above in the step response. I would use a more advanced control like forward feed control to eliminate this effect.

@WBahn: It is really nice of you that you try to help me. Everyone knows that the integral of a constant over t=0...infinity is infinity. But this is not the point. If a PI-controller really eliminated all the effects then everyone would only use PI-controllers. But this is not the case as you can see in the step response in my first posting. Sometimes other controllers (not only P or PID) are better.

My question is still why one PI controller is used frequently even for torque control.

Hi,

Yes that's nice but that is three block diagrams. Show one block diagram with the WHOLE system.
You should also indicate what each block represents.
As i said, i dont want to have to guess at any possible configuration.

#### GopherT

Joined Nov 23, 2012
8,009
Hello again,

@MrAl: You find the block diagram here:
View attachment 135703
Integral control alone would not be enough to eliminate the steady-state error as you can see above in the step response. I would use a more advanced control like forward feed control to eliminate this effect.

@WBahn: It is really nice of you that you try to help me. Everyone knows that the integral of a constant over t=0...infinity is infinity. But this is not the point. If a PI-controller really eliminated all the effects then everyone would only use PI-controllers. But this is not the case as you can see in the step response in my first posting. Sometimes other controllers (not only P or PID) are better.

My question is still why one PI controller is used frequently even for torque control.

PID (or PI) was never intended to achieve an absolute steady state. It was intended to dynamically control perturbed systems - most notably ships moving into port (Slowing down, turning, responding to currents, ...). A fuzzy logic controller might be a better option to get to a steady state for your particular system - dropping the I term after some number of time units (or ignoring I-terms more than X-time bins old). The I-term can "wind up" and get over emphasized in some cases (just when you don't want it) in a classic PID or PI calculation.

A Fuzzy logic system can be based on a PID control logic but modified as needed with step functions or other glue that does what you need.

#### WBahn

Joined Mar 31, 2012
30,076
Hello again,

@MrAl: You find the block diagram here:
View attachment 135723
Integral control alone would not be enough to eliminate the steady-state error as you can see above in the step response. I would use a more advanced control like forward feed control to eliminate this effect.

@WBahn: It is really nice of you that you try to help me. Everyone knows that the integral of a constant over t=0...infinity is infinity. But this is not the point. If a PI-controller really eliminated all the effects then everyone would only use PI-controllers. But this is not the case as you can see in the step response in my first posting. Sometimes other controllers (not only P or PID) are better.

My question is still why one PI controller is used frequently even for torque control.

Moderators not: removed unnessesary whtite space
The reason that controllers with integral terms are not always used is because (1) it is often not needed to achieve the desired performed, (2) the integral term introduces instability, and (3) the integral term makes the response history dependent. A common undesired consequence of this is integral wind up, in which the controller saturates in situations in which it lacks authority to bring the system to zero steady state (for instance, a cruise control on a car when going up a hill that is too steep to take at the commanded speed). The integral term continues to build (particularly in a digital controller where the integral term is just a number) and then once the load is removed the controller forces a large error in the other direction for a long time until the integral unwinds.

Your block diagram (the top one) is for a unity feedback system in which you are trying to control an output current with a desired reference current.

Clearly define what your controller is trying to control. Speed? Position? Torque? Voltage? Current? Then draw the block diagram accordingly.

If you can't explain how your system can have a drive term that builds up to infinity over time in the presence of a non-zero steady state error, then just pointing to an equation won't make it pass the "does the answer make sense" test.

#### sebastian-online

Joined Sep 22, 2017
5
Hello again,

@MrAl: Everything is specified. The first diagram shows the whole block diagram of the current control. In my first posting I defined G(s) and K(s). The circuit below shows just the equivalent circuit of the motor where I derived my equations from with the mechanical behavior (diagram 3). All symbols are already specified.

@GopherT: Thank you for your answer. My question is not how to find a better controller. It is not a problem for me because I am very familiar with control theory. I was just wondering why you find in nearly every commercial system a simple PI-current controller.

@WBahn: I am pretty familiar with the reasons against PI-controllers. You missed one reason: Sometimes the performance of them is really bad and other controllers do the job much better. All my post is about current control.
T(s) is the closed-loop transfer function. If a step is put on it then it is T(s)*1/s. With the control theory, you can show that the step response is lim s->0 s*T(s)*1/s = constant. This is a mathematical fact and fits also to reality as shown in the step response in my first posting.

#### WBahn

Joined Mar 31, 2012
30,076
So how do you explain, in steady state, having a current that is different than what you are commanding (i.e., a non-zero steady state error) and therefore having an integral term that is steadily increasing (without bound and in a linear system) resulting in an ever increasing drive signal but that is resulting in in any change in the output?

Or, for that matter, if the drive signal is constantly changing because of the integral term in the presence of a non-zero error signal, how can you claim that it is even in steady state?

#### MrAl

Joined Jun 17, 2014
11,494
Hello again,

@MrAl: Everything is specified. The first diagram shows the whole block diagram of the current control. In my first posting I defined G(s) and K(s). The circuit below shows just the equivalent circuit of the motor where I derived my equations from with the mechanical behavior (diagram 3). All symbols are already specified.
Hi,

Ok if that's good enough for you
I read and reply to many different posts and talk to people over the phone about this stuff so it helps me if i can see everything in one post, and clearly illustrated. That way i dont have to spend time trying to figure out what circuit it is and how it's connected and stuff like that, or have to look at other posts to figure it out.
It's so easy to draw stuff these days with the software we all have.
IF everything was on one page i could analyze this in about 120 seconds, but if it is spread out and not clear how everything is connected it takes a lot of time to figure that all out.
If you want to put everything on one page and clearly show how it is all connected i'll gladly do the analysis, but if not, i'll have to see if i can get back to this question later. See i think i know how you have it connected but it would be easier if it was all on one page.

Take care for now...

#### strantor

Joined Oct 3, 2010
6,798
You don't need to understand how an internal combustion engine works in order to drive a car; similarly you don't need to understand all the equations in order to setup and tune a PID/PI/PD loop in real life. That's where I find myself with regards to the math. I've never studied the equations you've posted and I don't intend to. I've set up and tuned several PID and PI loops in the past and tuned them successfully, often by adjusting trim pots on analog boards such that I had no idea what the actual values were. Also I glossed over much of this post so please forgive if I'm repeating someone.

All that being said (sorry, had to unqualify myself so as not to be pressed for mathematical answers), here's my input:

I think the answer is as simple as "a PI controller does not eliminate steady state error, and that's ok. If it weren't ok, we would be using something other than a PI loop." A PI loop is not a well developed loop and I think you're asking too much of it. Hell, PID is a better solution and even it has limitations.

#### GopherT

Joined Nov 23, 2012
8,009
You don't need to understand how an internal combustion engine works in order to drive a car; similarly you don't need to understand all the equations in order to setup and tune a PID/PI/PD loop in real life. That's where I find myself with regards to the math. I've never studied the equations you've posted and I don't intend to. I've set up and tuned several PID and PI loops in the past and tuned them successfully, often by adjusting trim pots on analog boards such that I had no idea what the actual values were. Also I glossed over much of this post so please forgive if I'm repeating someone.

All that being said (sorry, had to unqualify myself so as not to be pressed for mathematical answers), here's my input:

I think the answer is as simple as "a PI controller does not eliminate steady state error, and that's ok. If it weren't ok, we would be using something other than a PI loop." A PI loop is not a well developed loop and I think you're asking too much of it. Hell, PID is a better solution and even it has limitations.

The human body does something very similar to a PID loop when standing upright. Nobody stands perfectly still but most people don't fall over - even in wind, or when shifting weight off of a single point on the bottom of a foot to get blood flowing again. It is a gentle wobble that is barely noticeable but, not steady. The more you try, the faster the feedback loop and the higher the frequency of the wobble but, the wobble is never gone. The bottom of your feet are always moving (pay attention to those ankles, and toes. Even the knees and thighs get involved. Heck, the arms and head get involved. And, like @strantor said, we all do it without knowing about PID loop equations.

#### MrAl

Joined Jun 17, 2014
11,494
Hi,

The question seems to be why use it if it is inferior. That was the goal not to just dismiss the question. I intended to do a full analysis of the system in order to prove what is better and what is not better, and what could be better.

#### strantor

Joined Oct 3, 2010
6,798
Hi,

The question seems to be why use it if it is inferior. That was the goal not to just dismiss the question.
I wasn't trying to dismiss the question. My point was that not every application requires PID or higher control. Sometimes PI or even just proportional control is fine.

For example the place I used to work made wire & cable. There were several winder machines that would pay out or reel in wire, and they were controlled by a festoon dancer, which acts basically as a big capacitor for moving wire, absorbing any oscillating error. See what I'm talking about in the video below. See the dancer bobbing up and down throughout the video. That is a poorly tuned PID or just a simple proportional control, but it doesn't matter. The web still proceeds through the machine at a constant pace and never loses tension.

Some applications have a LOT of room for error, and in those applications it makes sense to use a lower control algorithm that is easier to implement.