Confused about PID controller for current control with PMW

  • Thread starter mechamania
  • Start date
  • #1
16
0
Hi,
I'm looking into the control of a PMSM (permanent magnetics synchronous motor) motors using H-briges and PWM (puls width modulation).

I'v seen motor controllers that use a PID controller for speed regulation. The output of the PID controls the PMW. This makes sense to me because the PMW controls the voltage of the motor phases and this is proportional to the speed. The speed is measured and feed back into the PID.

But now I want to regulate the torque, thus the current. I have seen implementations that use a PID controller with current inputs (reference and sensed phase current) and again the output of the PID controlling the PMW. So essentially the same setup as for speed control.
I do not understand this. The output of the PID should control the motor current. But it controls the voltage. The current will increase or decrease because of the voltage and inductance. So there is an extra integration going on. How is it possible such a PID loop works?
 

Answers and Replies

  • #2
1,763
59
You can regulate either speed or torque but not both at the same time. The motor controllers I have worked with, control the speed, increasing the torque as needed until the torque limit is exceeded. At that point the speed is reduced to keep the torque (or current) from exceeding its set limit. Sometimes the torque is limited on startup to keep the motor from accelerating too rapidly.

If on the other hand you need constant torque, then the speed must be free to change in order to deliver that torque.
 
  • #3
16
0
I understand that I can not control both torque and speed at the same time.
The point is that I do not understand how the torque regulation is done using the described PID controller with PMW.

The PID has current value inputs but controls the voltage of the motor. And the voltage of the motor is not proportional to the current because of the indictance. So how does this work?
 
  • #4
1,763
59
I'm sorry, I didn't notice before you mentioned that it is a synchronous motor. I believe the speed of a synchronous motor is controlled by the frequency, not the voltage. Why would you want to use a PID controller with a synchronous motor?
 
  • #5
16
0
I agree that the speed can be controlled by the frequency of the sinusoidal waveforms.
But in that implementation the motor position was used to generate the correct sinusoidal phases. And the PID output controlled the amplitude of the sinusoidal waveforms. So the
speed is indeed controlled by the voltage. The frequency adapts automatically.

My question still stands. How can a PID controller work when it compares current values as input and when it controls the PWM with its output. Because this PMW corresponds to voltage control. The current will increase or descrease because of the voltage. This is an extra integration.

I want a PID because I want to control the torque.
 
  • #6
828
1
I agree that the speed can be controlled by the frequency of the sinusoidal waveforms.
But in that implementation the motor position was used to generate the correct sinusoidal phases. And the PID output controlled the amplitude of the sinusoidal waveforms. So the
speed is indeed controlled by the voltage. The frequency adapts automatically.

My question still stands. How can a PID controller work when it compares current values as input and when it controls the PWM with its output. Because this PMW corresponds to voltage control. The current will increase or descrease because of the voltage. This is an extra integration.

I want a PID because I want to control the torque.

Can you provide the model or block diagram of both (voltage control and current control) PID systems? Often times you can use conversion factors to derive one from the other. You have an electrical transfer function or model that describes the motor components, right?
 
  • #7
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
i saved a Powerpoint presentation from TI that's pretty exhaustive
you might see if it's still available
title is
TI_MotorControlCompendium_2010.ppt

and once upon a time it could be downloaded here
from a post in February:
See if you can open the powerpoint presentation here -
( you need Microsoft's free powerpoint reader )

i think you'll like it.

http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT210201


http://focus.ti.com/download/trng/docs/c2000/TI_MotorControlCompendium_2010.ppt

hope it helps..

edit see around slide 165
i think it requires measuring rotor position and controlling "quadrature" current
which would to me mean phase, which becomes frequency...
so a pid on phase of stator voltage relative to shaft position ought to work,
isn't that power angle?

probably you're ahead of me aready.
 
Last edited:
  • #8
16
0
@DragonPeter
I have no models yet. I just want to understand how it works first.

@jim hardy
Thanks. Found it. Looks very interesting. Will take some time to study it ;-)
 
  • #9
828
1
@DragonPeter
I have no models yet. I just want to understand how it works first.

In that case, forgive me if I am thinking too simply or ignorantly here, but if you apply a voltage to a motor's terminals with any load whatsoever, then you will also have a current. Much like in a circuit you will have a current and a voltage with a load. If I tell you the voltage and resistance of a resistor circuit, you will be able to tell me the current with Ohm's law, and if I told you to increase the current by 10%, you could simply increase the voltage by 10% if R is constant. So if you can sense and control voltage, you indirectly are controlling current and vice versa because you know the inductance and resistance of the windings and the Km and Kt constants. You simply use a conversion factor to switch between the two. In a control system block diagram, you can tap between blocks to get the specific output,input, or variable you want to consider, but the system is still a closed loop.

For example, if a motor normally runs 600 RPM from an applied voltage of 50V, you already know what the torque will be at for a known load at that operating point. If you apply 50V, and the motor is running slower than 600 RPM, you know that the current has increased because the back EMF has dropped. The RPM that you're measuring is related to voltage by the motor constant, but indirectly you still know that the current has increased through the known relationship. So, you can lower the voltage in that case til the motor speed drops to a lower value, and for that value to correspond to the desired current by the known relationship.

That is how you could control torque indirectly from a voltage PWM/RPM measurement, but you could also have a shunt resistor to measure current semi-directly (but you could still control it with voltage by the relationship). If I'm off here, please explain to me why, because I will have a misunderstanding myself.
 
Last edited:
  • #10
16
0
@DragonPetter:

Thanks for your answer.
I agree for a pure resistor the voltage control is equal to current control.
But we have a lot of inductance here.
I also agree that I could calculate the needed voltage given the motor speed and motor
parameters (like back emf and inductance).
But the PID regulator does not use al this extra information.
That is why I do not understand that the PID controller works properly. The PID outputs a voltage only given the sensed current and wanted current. No speed sensing, no motor parameters are used.

I found a picture in the document jim pointed me to (see attached pdf file). It is from a FOC controller, but it shows that currents values are used as PID inputs and the output is a voltage. But a voltage to an inductor results in a current change, thus an extra integration. I do not understand this PID loop can work properly.

@ jim hardy:
I did read the document. Very interesting. Thanks again. I attached a page from it that shows my point. See above.
 

Attachments

  • p172.pdf
    84.8 KB · Views: 531
  • #11
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
dont forget the loop gets closed by rotor position.
 
  • #12
16
0
dont forget the loop gets closed by rotor position.

I found a better picture of a FOC controller.
Here you see the inner PID loops, controlling current.
And the outer PID loop controlling speed.
The rotor position is needed for the transformations.

The output of the inner PIDs control the PMW, thus controls the voltage on the motor windings. The voltage is propotional to motor speed, not motor current.
So why is the current feedback and not the speed?
 

Attachments

  • foc.jpg
    foc.jpg
    57.4 KB · Views: 1,271
  • #13
16
0
I found a better (much simpler) controller diagram to explain my question.
See attachment again.

Here the torque (is current) is controlled by a PI controller. The output is a voltage.
The PMW makes sure this voltage is applied to the motor.
But the motor current is feedback to the PI controller!

I do not understand this.
The voltage on a motor is more or less proportional to the motor speed. So it makes more sense to me to feedback the speed. The voltage will increase or decrease the current because the motor is an inductor. So the voltage gets mathematically integated. How can a PI controller work with this (integrated) feedback?
 

Attachments

  • torqueControlDCMotor.jpg
    torqueControlDCMotor.jpg
    40.9 KB · Views: 1,227
  • #14
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
In your DC motor example, most recent post, ...

why can't two integrators be cascaded?

just their time constants need to be separated ..

and - feeedback is measured current and is compared to desired so error will be forced to zero
so far as the control system is concerned, output is measured current
and motor's transfer function is just one more term
motor coild be moved inside yellow block

try thinking of the motor as a first order lag instead of an integration
because it really does have an L/R time constant so will not integrate for very long.

any help?
 
  • #15
16
0
@jim

Thanks for you answer.
I'm afraid the PID want work stable enough when cascading two integrators.

So what you are saying is that you can control the motor current by controller the voltage in a more or less proportional way. And the integrattion will not disturb the PID controller?
 
  • #16
828
1
As you see in the example you provided, the PI controller block diagram has the conversion built into it.
 
  • #17
828
1
I do not understand this.
The voltage on a motor is more or less proportional to the motor speed. So it makes more sense to me to feedback the speed. The voltage will increase or decrease the current because the motor is an inductor. So the voltage gets mathematically integated. How can a PI controller work with this (integrated) feedback?

Applied voltage is not directly related to motor speed. It is proportional, but the actual speed is dependent on other factors too - the current/mechanical load.

It is the back-EMF that you need to think about. And the back EMF is the parameter that is dependent on the angular velocity of the rotor. It fights with your applied voltage as an inherent negative feedback, and when the motor is producing higher torque, the back EMF has decreased for the same applied voltage. Your current relationship comes in to play here, as this back-emf reduction causes a larger voltage drop across the windings -> more current through them. The parameters are all related by equations, so it is not magic that you can control the current with the voltage.

Saying the motor is an inductor really does not have much importance with the current/voltage relationship other than the back EMF effect. The inductor aspect is more important for understanding electrical transient behavior of the motor, about just as relevant as the internal resistance of the motor as far as your original question goes.

The answer to your question really boils down to following the units conversions in the block diagram path. Like I said, it is a conversion factor that is built into the closed loop somewhere that translates an applied voltage to the motor's current.
 
Last edited:
  • #18
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
And the integrattion will not disturb the PID controller?

first i dont think the inductance truly integrates because it isn't a pure inductor. it has a time constant so is a frst order lag

1/s isn't same as 1/(s+a)

second - cascading controllers is tricky but commonly done.
look up three element feedwater control.
drawing courtesy of this fellow: http://www.controlguru.com/wp/p44.html

LC and FC are both p+i 's, and boiler integrates the flow error....



here's an image that looks more like my feedwater control system
G2 and G3 in cascade

1-s2.0-S0307904X07000686-gr3.jpg

courtesy of this fellow: http://ars.els-cdn.com/content/image/1-s2.0-S0307904X07000686-gr3.jpg

here's a nuts&bolts explanation i use for my guys:
since flow measurement Wf and Ws into flow controller G3 is imperfect, level controller G2 will force level to desired with whatever offset in reported flows W makes system settle.

observe there's a boiler closing the loop, it integrates the true flow mismatch. so i see a 3 integrator closed loop.

any help ?

if someone well versed in motor controllers is reading, please chime in. my interest in them is purely hobby level.
 
Last edited by a moderator:
  • #19
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
my interest in them is purely hobby level.
that sounds dismissive and rude, in retrospect, which was not my intent at all

i shoulda said "My interest in them is from natural curiosity ; i never worked on them so am not expert."

sorry if the remark offended.
 
  • #20
828
1
that sounds dismissive and rude, in retrospect, which was not my intent at all

i shoulda said "My interest in them is from natural curiosity ; i never worked on them so am not expert."

sorry if the remark offended.

I read it just as you being your normal humble self haha. That brings up something I've wondered for a while now, is where to draw the line behind hobby and professional work being valid. I think a professional experienced engineer can do hobby work that is much better than a beginning engineer's professional work. Also, some amateurs can have designs that are useful in professional areas.
 
  • #21
16
0
Thank you both very much for explaining all this stuff.

I think I start to understand now why you can control the current by applying a voltage calculated by the PID that has current values as input.

I found an example where a measured speed is used to compensating for the back-emf by adding some value (depending on speed) to the voltage output of the PID. So that the voltage will be incremented automatically at higher speeds to compensate the back-emf.

This way the PID does not have to deal with the back-emf (or has to deal less with it).
Do you think this is a good idea?

I found this in the following (very interesting) document:
ABOUT COMMUTATION AND CURRENT CONTROL METHODS FOR BRUSHLESS MOTORS
When you put this title in the Google search bar it will be one of the first hits.

Figure 4.2 shows the compensation. It is part of a (FOC) Field Oriented Control controller (called Synchronous Regulator in this document). I understand the FOC mechanisme and I understand most of figure 4.2.

But figure 4.2 also shows 2 other compensations, which I do not understand:
ωLd and ωLq. Any idea why this is?
 
  • #22
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,847
4,883
here's the only line i saw that leapt out at me.

For better dynamic performance, crosscoupling
terms (ωLdId and ωLqIq) may also be compensated as in Fig. 4.2.

and w is commutation frequency

and this was above on page 7
Traditionally, the commutation function generates balanced 3 phase sinusoidal or
trapezoidal current commands with angles synchronized to the rotor position. With this
implementation, analog current regulator is implemented for each phase. The same commutation and current control can be realized by a microprocessor-based digital control, although different current regulation schemes such as synchronous regulator are becoming popular. For drives with phase current regulator, phase current command waveforms on the motors are sinusoidal (or with harmonics for some motors) with the commutation frequency proportional to the speed of the motor. For high speed variable motors with a large number of pole-pairs, maximum commutation frequency (fc) may be several hundred Hz or even higher. Since current regulators on AC motors should produce negligible magnitude and phase errors at all operating frequencies in order to produce desired torque, current regulator bandwidth must be high. In general, it is desirable to have the current loop bandwidth (fbw) at least 4 - 5 times the maximum electrical frequency and phase lag should be compensated by means of “phase advancing technique” [2] at the current command stage.

and ref [2] is us patent 4447771
which only says phase is adjusted " to control torque and back emf constants..... by some adequate system parameter." second page of text, lower right...

So i am guessing here that it's a small commutaion angle trim to account for an L/R time constant, perhaps even the motor's leakage reactance.

But that's a guess.

These complex monsters are in our washing machine motors these days - so i have stashed away several old induction motors, and a '68 Ford pickup.
This rate-of-change of complexity can't last, can it?

In India they're reprinting turn of the century EE textbooks..
i have my original of this one, printed in 1901

51UY9-IZVvL._SL500_AA300_.jpg

https://www.amazon.com/dp/B006FNDPG2/?tag=pfamazon01-20

Back to the Future!

old jim
 
Last edited by a moderator:
  • #23
818
67
Figure 4.2 shows the basic structure for field oriented control of the stator currents of a PMS machine with back-emf decoupling added.

It won't make much sense unless you understand the reference frame transformation (Park's transformation) that produces that particular model from a PMSM model expressed in phase quantities.

The terms they add/subtract to/from the output of the controllers are the nonlinear back-emf terms that act as disturbances in the sense of classical control. It is feedforward compensation to decouple the two first order systems that produce the direct and quadrature current components, respectively.

Edit:
Your feedback controllers will have some degree of disturbance rejection (depending of course on how well you designed them), so you don't strictly have to use decoupling as shown in Figure 4.2. It's a good idea though since you usually measure the stuff that goes into the back-emf terms anyway and it's extremely simple to add in your DSP/microprocessor code (it was literally two terms in a couple of lines of C-code for a TI 28335 DSP when I was doing FOC at uni).

You also see this type of feedforward compensation for the back-emf when controlling DC-motors, it's just much less important in that case since the back-emf term only depends on the angular speed of the motor (which changes very slowly compared to the current in the armature windings) and any compensator with integral action will be very effective at rejecting it.
 
Last edited:
  • #24
16
0
So i am guessing here that it's a small commutaion angle trim to account for an L/R time constant, perhaps even the motor's leakage reactance.

But that's a guess.


old jim

So do I understand correctly that the two terms ωLdId and ωLqIq together result in a angle adjustment/change?
 
  • #25
16
0
Figure 4.2 shows the basic structure for field oriented control of the stator currents of a PMS machine with back-emf decoupling added.

It won't make much sense unless you understand the reference frame transformation (Park's transformation) that produces that particular model from a PMSM model expressed in phase quantities.

The terms they add/subtract to/from the output of the controllers are the nonlinear back-emf terms that act as disturbances in the sense of classical control. It is feedforward compensation to decouple the two first order systems that produce the direct and quadrature current components, respectively.

Edit:
Your feedback controllers will have some degree of disturbance rejection (depending of course on how well you designed them), so you don't strictly have to use decoupling as shown in Figure 4.2. It's a good idea though since you usually measure the stuff that goes into the back-emf terms anyway and it's extremely simple to add in your DSP/microprocessor code (it was literally two terms in a couple of lines of C-code for a TI 28335 DSP when I was doing FOC at uni).

You also see this type of feedforward compensation for the back-emf when controlling DC-motors, it's just much less important in that case since the back-emf term only depends on the angular speed of the motor (which changes very slowly compared to the current in the armature windings) and any compensator with integral action will be very effective at rejecting it.

So what would the result of this compensation be? Or better, what is the problem when I do not have this compensation?
 

Related Threads on Confused about PID controller for current control with PMW

  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
2
Views
3K
Replies
3
Views
132
Replies
6
Views
937
  • Last Post
Replies
13
Views
3K
  • Last Post
Replies
4
Views
1K
Replies
2
Views
4K
Replies
5
Views
1K
Top