Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Confused about PID controller for current control with PMW

  1. Jul 30, 2012 #1
    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?
  2. jcsd
  3. Jul 30, 2012 #2
    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.
  4. Jul 30, 2012 #3
    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?
  5. Jul 30, 2012 #4
    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?
  6. Jul 30, 2012 #5
    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.
  7. Jul 30, 2012 #6
    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?
  8. Jul 30, 2012 #7

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    i saved a Powerpoint presentation from TI that's pretty exhaustive
    you might see if it's still available
    title is

    and once upon a time it could be downloaded here
    from a post in February:
    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: Jul 30, 2012
  9. Jul 30, 2012 #8
    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 ;-)
  10. Jul 30, 2012 #9
    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: Jul 30, 2012
  11. Jul 30, 2012 #10

    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.

    Attached Files:

    • p172.pdf
      File size:
      84.8 KB
  12. Jul 30, 2012 #11

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    dont forget the loop gets closed by rotor position.
  13. Jul 31, 2012 #12
    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?

    Attached Files:

    • foc.jpg
      File size:
      57.4 KB
  14. Jul 31, 2012 #13
    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?

    Attached Files:

  15. Jul 31, 2012 #14

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    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?
  16. Jul 31, 2012 #15

    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?
  17. Jul 31, 2012 #16
    As you see in the example you provided, the PI controller block diagram has the conversion built into it.
  18. Jul 31, 2012 #17
    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: Jul 31, 2012
  19. Jul 31, 2012 #18

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    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

    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: Apr 30, 2017
  20. Aug 1, 2012 #19

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    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.
  21. Aug 1, 2012 #20
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook