OK, the following is a summary of my understanding of permanent magnet motors and their control in the hope that it may prove useful to others.
Sorry for the length of it, when I started writing I only expected a fraction of this but it just seemed to keep expanding.
Any errors (and I'm sure there are) please let me know and I'll correct them. I'm no expert on the subject and this is just the way I find useful in visualising and understanding how motors work (and how the way we control them might affect things).
It's mostly relevant to IPM motors but a lot will be relevant to SPMs too.
I’m going to start at a fairly basic level, so apologies if it seems too basic, but I want to try and make sure I’m not using terms and ideas without explaining the background behind them. I’m also going to try and avoid jargon, mainly because I can’t remember a lot of the correct terminology without looking it up first. I’m going to aim for understanding not maths!
Two basic concepts fundamental to motors are:
1) A wire carrying a current in a magnetic field will experience a force on it – this is why a motor turns.
2) A wire in a changing magnetic field will have a voltage induced in it and the direction of the induced voltage is so as to oppose the change in field that produced it – this is why a motor has a maximum speed.
I’m going to start with traditional DC motors as I find it easier to understand these and then build on it to move to other motor types. In a traditional DC motors the coil of wire is on the inside (on the moving bit – the rotor) with the magnets on the outside (the stationary bit – the stator). The magnets generate a magnetic filed around the coil and currents flowing in the coil then generate a force on the coil. Now with a coil there are orientations where the forces from the magnet on different parts of the wire cancel out and there are orientations where they will add. With a DC current applied the motor rotor will move till it reaches a position where they cancel and the rotor will stop. On a DC motor the commutator (the copper contacts and brushes on the motor shaft near one end of of the motor) are arranged so that a new set of windings are switched in, and the old set switched out, before this position is reached. The new windings will continue to experience a force and the motor will continue to turn until the next commutation event. There is quite a good animated diagram of this here
https://en.wikipedia.org/wiki/DC_motor, about half way down on the right hand side.
Now our motors are a bit different, there is no commutator but the principle is much the same. Current in the coils causes a force which turns the rotor. Now without a commutator a DC current will cause the motor to turn till it reaches a position where all the forces on the windings cancel (coil vertical on the above linked digram). Now with the motor in this position the current flowing is called direct current or Id. Id does not generate torque – it does not produce movement. It is actually best at holding the rotor stationary (this is what’s used in stepper motors to hold them still). For an ideal (for ideal read non-existent – it’s a term used in physics/engineering to temporarily ignore all the real world behaviours that are also there!) motor that is trying to generate rotational power Id is wasted energy (please note the ideal, our motors aren’t and I’ll get back to Id doing something useful later).
Now if you imaging the rotor being 90degrees from this position (or horizontal in the above linked diagram) this is where all the forces on the coil add, or where we generate maximum torque. Current in the coil with the rotor in this position is called quadrature current or Iq. For an ideal motor this is what we want, it generates the torque which spins the motor and moves the car. The more current, the more torque, the greater the acceleration.
You can imagine that for any rotor position a current flowing in the coil can be considered to be a combination of Id and Iq; with the rotor vertical it is all Id, with it horizontal all Iq. At positions in between it is a combination of both. The commutator on a DC motor is a crude way of trying to maximise Iq and minimise Id for all rotor positions and you can probably see that the effectiveness of the commutator will depend on how many switches it does per rotation. Fewer switches (or fewer segments on the commutator) causes large variation in Iq and Id as the rotor turns (but makes for a simpler and cheaper motor to manufacture). More segments on the commutator gives better performance but at higher manufacturing cost. The commutator also can’t provide a lot of other features that we need so we don’t use one! Instead commutation is done electrically within the inverter which allows much, much better control.
One other nice thing about the commutator is that since it is on the rotor shaft it moves with the coil giving it an absolute reference of the rotor position. The position of the rotor precisely determines when the commutation events occur. Our motors don’t have a commutator so don’t have this reference. Instead a position sensor is used, typically an encoder or resolver. How these work is not relevant here, all that is important is to understand that the resolver is used to tell the electronics exactly what the angular position of rotor is so that it can work out how to drive the coils to generate the correct values of Iq and Id (and for an ideal motor Id=0). Any error in the resolver directly becomes error in Iq and Id.
When we talk about FOC tuning what we are actually doing is teaching the electronics what resolver output corresponds to the rotor being in the direct current position. Once the electronics ‘knows’ that it can work out how to drive the coils.
The other difference on our motors is that the magnets are in the middle on the rotor and the coils are on the outside on the stator in the form of windings around a laminated core. The core is there to concentrate the magnetic field produced by the windings and focus it onto the magnets in the rotor.
So far I’ve just talked about currents, they are what produce torque. We also need to talk about voltages, these produce the currents. We apply a voltage to the coils and this, imposed across the resistance and inductance of the coils, causes the current to flow. We want torque, to generate torque we need amps and to generate amps we need volts. The control for the motor is all about working out what volts we need to apply to the coils, and when we need to apply it, to generate currents in the windings that correspond to the Iq and Id needed to get the motor to do what we want.
Now for a quick diversion into voltage/current representations. I don’t know about you but I just can’t think in terms of 3-phase systems. All the above is talking about single phase, or one coil, and that I can just about cope with. Getting my head around the above for a 3 coil, 3-phase, system is too much. Fortunately we don’t have to There are a couple of really nice transforms called the Park and Clarke transforms, what they do is take the rotor position and the 3-phase coil/winding currents and turn them into the Iq and Id components. We can then work with these much simpler Iq and Id components to do all the control stuff to calculate direct and quadrature voltages (Uq and Ud) and then use the inverse (reverse) Park and Clarke transforms on these to get back to 3-phase voltages to actually apply to the motor.
The control algorithm inside the motor controller is basically to take in the rotor position and use this along with the target torque (or accelerator position) to calculate what voltages to apply to the motor windings to generate this toque.
Unfortunately we now need to start talking about the non-ideal (i.e. real) behaviour of motors. An ideal motor would have no resistance, no reactance, no eddy current losses, no back EMF, no saliency, no inertia, no backlash, no saturation, etc, but they do have all of these. Some of these hurt performance, some have minimal impact but some actually help.
I’m not going to consider all of them, just the ones that are relevant to understanding the operation and control of the motor. The main ones are inductance, back EMF and saliency.
Inductance first. Inductance is essentially a measure of how a component affects current flow, in particular how it affects changes in current flow. A piece of wire has low inductance, you can ramp currents though it up or down very, very quickly with very little voltage. A coil or a winding has high inductance. What this means is that if you apply a voltage across an inductor the current will increase relatively slowly, how slowly depends on the size of the inductor. I’m trying to avoid equation, but some are useful – the voltage needed to produce a particular rate of change in current in an inductor is given by V = L*di/dt. To give an example, say we have a winding inductance of 10mH and we want to change the current by 100A in 1ms, the equation then gives a required voltage of 0.01*100/0.000001 or 1000V. This is a significant number of volts, a lot more than our batteries can provide. To look at it another way, how quickly can we ramp up the current, on the same inductor, with a 350V pack - i/t = V/L so 35A/ms. This may seem pretty quick but the motor control loop typically runs at 8.8Khz or 113us per loop round so in each loop the motor inductance limits the maximum current change to 4A – no much. The take home message from this is that the inductance means that the control loop is limited in how quickly it can actually control the motor, you can’t just set the new current value you need to ramp towards it. You might say why not reduce inductance? The trouble is you reduce inductance by reducing the number of turns or reducing the size of the lamination, both reduce magnetic flux and so both reduce torque. A big motor that generates high torque will typically have high inductance.
There is a silver lining with inductance though, without it PWM control wouldn’t work. We don’t actually apply a voltage, we apply a a pulse width modulated pulse. This is a waveform that is a full DC bus voltage for a percentage of the time and at 0V for a percentage of the time. The inductance of the motor effectively filters this to give a net current change that is the same as the averaged voltage over the same period would provide. The inductance is also what allows regen below base frequency to work (see here for more detail and a great simulation catphish did that explains it
viewtopic.php?p=38772#p38772).
The back electro-motive force (BEMF) is the next one. Remember at the start I said that a wire in a changing magnetic filed has a voltage induced in it, well this is the BEMF of the motor. Imaging an unpowered motor spinning, the windings are seeing the magnets in the rotor go past, this is a changing magnetic field to them and so a voltage is induced in them. This is how generators work. The same happens when the motor is powered, a BEMF is generated which actually opposes the Uq term. As the motor speed increases the BEMF increases. The effect of this is that some of the Uq that the controller is applying to the motor to get it to accelerate is being used to counter the BEMF instead of producing torque producing Iq. The effect of this is that the acceleration of the motor slows. This continues until the BEMF actually equals Uq at which point the motor can no longer accelerate. This is what is often called the motors base speed. The way round this is called field weakening. Essentially to go faster we need to reduce the BEMF, to reduce the BEMF we need to reduce the flux linkage. You can sort of think of this as reducing how much of the flux from the rotor magnets links into the stator windings. On motors that use windings on both the stator and the rotor the normal way to do this is to reduce the current in the rotor winding, this reduces the flux and reduces the BEMF. With permanent magnets in the rotor we can’t do this but what we can do is create a magnetic field in the stator windings that opposes the field of the permanent magnets in the rotor – effectively this reduces the apparent strength of the permanent magnets, which reduces the flux and so reduces the BEMF. If you imagine that as the rotor turns the controller generates a rotating opposing field in the windings that moves exactly in sync with the rotor and cancels out part of the magnets field. It sounds complicated that way but due to the magic of the Park/Clarke transforms it just becomes the addition of a continuous negative Id current. As long as the -Id is there the BEMF is suppressed and the motor is able to spin up to higher speeds. The problem comes if, for any reason, the -Id is lost. If it is removed then the full BEMF for the higher speed reappears which can then force high currents back through the converter and into the battery. This is the unwanted regen effect which can be seen; it means that for some reason the -Id has been lost.
Saliency of the motor is when the inductance seen by the Id and Iq currents are different. It’s due to the different magnetic permeabilities of the magnets themselves and the steel lamination that the rotor is made of (SPM tend to be low saliency, IPM high). When the rotor is in the Id position there is more magnet material in the flux path which gives a lower inductance, in the Iq position there is more steel giving a higher inductance. This is also the reason why and IPM tends to have more coggyness than an SPM. The difference also means that that it’s not just Iq that creates torque, on a high saliency motor negative Id can also create torque. I still don’t fully understand why this happens (there are plenty of equations for it but I haven’t found a good way of actually understanding it). This is where MTPA (maximum torque per amp) comes in. There are a number of equations that can be used to calculate what the best combination of Iq and Id are to produce the maximum torque for a given current for a given set of motor characteristics. The relevant characteristics are flux linkage and Lq – Ld which can either be measured or found by trial and error.
With these effects in mind you can see what the inverter controller needs to do. Each time it runs it measures the instantaneous rotor position and uses this along with the instantaneous 3-phase motor currents to calculate the instantaneous values for Iq and Id (using the Park/Clarke transforms). Separately it then uses the torque request (accelerator position), MTPA algotithms and field weakening requirements to calculate what Id and Iq should actually be. PI controllers are then used to compare the measured Iq/Id and the calculated Iq/Id currents and produce control outputs which are the voltages Uq and Ud which need to be applies to the windings to move the currents from the measured values towards the ideal calculated values. The inverse Park/Clarke transform is then used to convert these Uq and Ud values back to the 3-phase voltages that are used to drive the PWM duty-cycles. In the steady state (constant speed) the PI controllers should hold Iq and Id pretty much at the ideal values. Under acceleration, deceleration, changing load or changing battery voltage there will be some delay and so some error but the controllers should always be pushing the measured Iq and Id values closer to the ideal values.
PI controllers are another topic completely and I’m not going to try to cover them here but it is worth covering a couple of terms that regularly get used when discussing them. Closed loop is when the controller output is controlling the monitored input, it’s when the loop is actually controlling the value and a change in the input causes a change in the output. Open loop is when the output has hit the end stops, when it can no longer move any more. At this point the controller is no longer in control of the monitored input as input changes have no effect on the output. The normal goal with controllers it so keep them in the closed loop region, when they move in to the open loop mode things can get unpredictable, they may gracefully transfer back into closed loop without any problem but they also may lose control completely. Stability is desirable in a control loop as it makes it easier to stay in the closed loop region.
The final thing to mention is pole counts. The motor in the linked diagram is a single pole pair motor (one pair of magnetic poles). Our motors are typically 4 or more pole pairs. The number of pole pairs does not make any real difference to the above discussion. Motors with an increased number of pole pairs work in exactly the same way they just compress a single magnetic rotation into a fraction of a mechanical rotation so for example a 4pole pair motor will go though a full 360degree magnetic rotation in just 90degrees of physical rotation. The extra pole pairs help in a number of ways, torque goes up because all the pole pairs work in parallel, the more compact angular dimensions make aligning the magnetic flux easier, they reduce the torque ripple, reduce winding inductance, etc. The only downside is that they need higher levels of commutation but with electronic commutation that isn’t really an issue.
Once again, apologies for the length of this - hope it's useful!
(it's been useful to me at least as while writing it I've realised that there are a couple of things not quite right in the way simulator models the effect of load on base speed, or rather how it doesn't model the effect of load on base speed!)
MUCH LATER EDIT - The above explanation of BEMF and field weakening is a little oversimplified. It is accurate for the case where there is no current flowing in the motor but isn't a complete description when there is. When current is flowing two additional terms appear in the motor equations, a Vq term and a Vd term. The Vq term is equal to +wLdId and the Vd term is equal to -wLqId. It is the Vq term that is used to provide field weakening as it is the opposite polarity to the BEMF. If the BEMF term is equal to the Vq term (or wλ = wLdId) then the BEMF is fully cancelled and the quadrature voltage at the motor terminals will be zero allowing the motor to spin to high speeds; the current at this point is termed the critical current. It is worth noting that for some motors this critical current is within the operating current circle and in this case it is important that the field weakening current does not exceed this current (if it does the voltages will start increasing again and control of the motor could be lost). The terminal voltage of the motor is at the minimum with Id = Icrit and Iq = 0. As the currents move away from this point the terminal voltage of the motor will increase and the speed at which they increase is proportional to frequency; the higher the frequency the more important it is that the controller has Icrit correctly set.
See
viewtopic.php?p=47287#p47287 for more details and a diagram.