Field Oriented Control of Permanent Magnet Motors
In this session, we investigate the Field Oriented Control process in an easy to understand way using animations and simulations.
Resources
Hi, my name is Dave Wilson, and I work for Texas Instruments. For the next hour or so, I'd like to talk with you about perhaps the most important motor control technique since the invention of the electric motor. It's called field oriented control.
Now, it was first proposed by a researcher at Siemens named Felix Blaschke in the late '60s. In his system, he actually had flux sensors in the air gap of the machine in order to sense the flux. But today, the technology has evolved to the point where we don't need flux sensors in the air gap. In fact, we don't need any sensors at all, except for the signals that the motor is providing. Now, that's called sensor-less control, and we'll talk about that later in the presentation.
But to introduce the topic, let's first take a look at how torque is controlled in a DC machine. On any electrical machine, in order to control the torque, we must control the current. Now, this slide might seem rather simplistic, but bear with me, because there's an important point that I want to make at the end of this slide.
First of all, we're going to divide the process up into four distinct steps. And the first step is we need to measure the current that's already flowing in the motor. So in this case, I show a shunt resistor, which is actually feeding an A to D converter. So we take a sample of the current reading. And then number two, we compare the measured current with the desired current, and generate an error signal.
Now, once we have that error signal, step three is we amplify the error signal to generate a correction voltage. Notice that in order to control current, we're actually using voltage. If the current is too low, we need to increase the voltage, and if the current is too high, we need to decrease the voltage. And then finally, we simply modulate the correction voltage onto the motor terminals.
So why is this slide so important? Well, the reason I broke it up like this is because these four steps right here constitute the process of doing current mode control. And you can picture this as being done by a processor, where each one of these steps are done thousands, or perhaps even ten thousands of times every second.
The point I'm trying to make, and this is the relevant point here-- if you can understand these four steps, then I think you're well on your way to understanding field oriented control. In fact, what we're going to see as we go through this process is that field oriented control falls under these four basic steps. And you'll notice, at the top of every slide that we're discussing, you can take a look to see which step we're actually on, whether it's step one, two, three, or four.
So with that said, let's take a look now at how we control torque on an AC machine. With a three phase machine, we obviously have three currents to control instead of just one. And if you look at those three currents on a space vector diagram, what you'll see is the addition of those three currents will actually create a current vector with a certain magnitude and a certain angle. So by controlling those three phase currents to be just the right values, we can create a current vector to be at any angle and any magnitude that we want.
So the question becomes, what angle should we shoot for? To answer that question, let's take a look at the chart in the upper right hand corner of this slide. And here, I've actually plotted the torque produced by a permanent magnet three phase machine as a function of the angle between the rotor flux and that current MMF from the stator.
Now, you see that zero degrees-- in other words, when the current MMF vector is right on top of the rotor flux vector, there's essentially zero torque. But as we get out to either plus 90 or minus 90 degrees, we see that at that point, we actually get the maximum amount of torque for a given amount of current. In other words, that's the maximum torque per amp angle.
So it makes sense that, in most cases, what we should shoot for is to try to orient our stator current MMF vector to be at 90 degrees with respect to the rotor flux. If I can achieve this, then the torque equation at the bottom of the slide applies. And that indicates that the torque on a three phase permanent magnet machine is proportional to the product of the rotor flux times the component of the stator current vector, which is at 90 degrees, with respect to that rotor flux vector.
To control the torque on the machine, I don't change the angle of my stator current vector with respect to the rotor flux. I always leave that at 90 degrees, because that's where I get maximum torque per amp. Instead, I regulate the amplitude of the stator current vector.
So to do this on a digital processor, the process would go something like this. I'm going to get an interrupt on my processor. I'll go into the interrupt service routine. And the first thing I want to do is measure the rotor flux angle, because once I know that angle that the rotor flux is at, then it becomes simply a matter of calculating the right values for phase A, phase B, and phase C current to create a stator current vector, which is 90 degrees with respect to that rotor flux angle. I then apply voltages to the windings of the machine in an attempt to regulate the currents to be the desired values that I just calculated.
After I do that, I exit the interrupt service routine, and then maybe 100 microseconds later, I get another interrupt. By this time, the rotor has moved to a different angle, so I need to read that new angle, and then recalculate my current values again. I do this over, and over, and over, and that is the process of field oriented control.
So let's go ahead and start the process. And I'm going to measure the current, or in this case, the currents, plural, that are already flowing in the motor. Now, I'm going to assume that my motor windings actually form an isolated load. In this case, that means that they're not connected to the motor frame, or they're not connected to earth ground. They're just connected to each other, and that's it.
So what that means is I don't need to measure all three phase currents as shown here. If I know the currents that are flowing into phase A and phase B, then if the circuit is isolated, that means that both of those currents' sum, together, have to equal the current that's flowing out of phase C. So what I do is I take those two readings with my A to D converter, and those are just scalar values. So figuratively speaking, I can reflect them along the magnetic axes for each one of the phases as shown to the right here.
So I'll take the scalar reading for phase A. That goes along the A magnetic axis. And then the same thing for phase B. Now, I take those two amplitudes, those two values, and I negate them, and I reflect those along the C axis. So since both A and B currents are positive, that means that, by definition, C current must be negative.
Now, I actually have three current vectors. And if I add them together, I can then form the net current vector, and that's the vector that I want to orient to be 90 degrees with respect to my rotor flux. So at this point, we've already completed step one, and we're ready to move on to step two.
So step two is to take the measured currents, and compare them with the desired currents, and generate error signals. So here, I have this stator current vector that I calculated in the previous slide. And the question then becomes, well, what is the desired current vector? Is that really what I want? Well, it depends on what the angle of the rotor flux is. So if my rotor flux is along this axis, for example, then yes, perhaps that's exactly what I want, because it's at 90 degrees with respect to that.
But let's say that the rotor flux is actually along this axis. Then that means that we would want to have a commanded current vector to be at 90 degrees with respect to that. So we actually can form an error vector, as shown here. How do we correct for this? Well, we need to regulate the input currents, iA, iB, and iC, to be just the right values so that we move the stator current vector to be on the same axis as the commanded current vector.
So it should be pretty obvious from the previous slide that if we're going to regulate the motor currents correctly, we need to know what the angle of the rotor flux is. And we can do that on a permanent magnet machine relatively easily by measuring the angle of the rotor itself. That's why these machines are called synchronous motors, because the angle of the rotor flux never changes with respect to the angle of the rotor. So if I measure the angle of the rotor, then I know what the angle of the rotor flux is going to be. Now, with AC induction machines, it's not quite that simple, because the rotor flux is sweeping across the face of the rotor at a frequency which is equal to the slip frequency.
But for now, let's just keep our attention focused on permanent magnet machines. How do I achieve that angle of the rotor flux? Well, I need some kind of shaft sensor, which would give me really good angle resolution. And there are several devices that can do that. For example, a resolver or an encoder are good choices for doing this. And that angle is usually taken with respect to the magnetic axis of phase A. That's the way the equations have just traditionally been set up to work.
The problem with either one of these devices is that they can be very expensive. So we're going to see later in the presentation how, for a lot of speed control applications, we can actually do away with the resolver or the encoder, and do the flux angle estimation just by looking at the signals coming back from the motor.
So here, you can see a pictorial representation of what we're trying to accomplish. We measure the currents in phase A and phase B. We then add them together and then negate that sum, and that actually forms the current for phase C. So now, we have all three currents measured in the machine, and what we do is we compare those against the desired currents.
And how are those desired currents calculated? Well, they are actually synchronized to the rotor angle by measuring the angle of the rotor. And then from that, those currents are calculated in such a way that they will generate a net current vector, which is 90 degrees with respect to the rotor flux. And when that happens, it turns out that those currents will actually take the shape of sine waves.
So we have three current regulators working in the stationary frame. But it turns out that nobody does it this way, because there's actually a better way. And we'll talk about that in the next slide.
You may recall from your trigonometry class that in order to specify a vector's magnitude and angle, we need a coordinate system with only two axes, not three. So really, with our three phase machine, we have a redundant phase. And we can actually simplify the calculations by converting our three phase machine into a two phase machine. So you can actually think of the machine as a two phase machine, where the coils were mounted at 90 degrees with respect to each other. So I would have a sine coil and a cosine coil.
Now obviously, we're not changing the machine at all. We're just changing how we look at it. So we're going to create two axes. One is the alpha axis, and the other one is the beta axis. And we're going to take our three phase currents and translate those into equivalent alpha and beta coordinates. And the equations to do this are actually very simple. It's just three multiplies and a subtraction, and that's it.
So you can see here how I can use the Clarke transformation to simplify the current regulation process. Once again, I sample the phase currents for phase A and phase B, and from that, I can calculate phase C current. Once I have those three currents, I use the forward Clarke transformation to turn those three currents into two equivalent currents, which exist on the alpha-beta reference frame.
And then I do the regulation in that reference frame. I compare those currents to the desired currents to generate correction voltages, v alpha and v beta. Then I use the reverse Clarke transformation, which I haven't talked about yet, but we'll get into that in a later slide. I use that to turn the v alpha and v beta voltages into three phase voltages that I can actually drive my machine with.
So you can see I've actually reduced the number of current regulators from three to two. But it turns out that nobody does it this way either, because there's even yet a simpler way to do it. And we'll talk about that coming up.
To introduce the next level of simplification, let's take a look at this slide. Let's say that you're in college, and you've been assigned to a design team whose job is to design an optical tracking system to track a target that's moving on a merry-go-round. So as the target is moving, or is spinning round and round, from your vantage point, it looks like the target is actually following a sinusoidal profile. And as the merry-go-round goes faster and faster, of course, that means that the frequency of that sine wave is going to increase. That means you might have to design your optical tracking system with better components, higher frequency components, because it's obviously a lot harder to track a high frequency object than it is a slower moving object.
So we see here that tracking a rotating object from a stationary reference frame is not a very easy task to do. How can we simplify that?
Now, let's say that there's another design team that's been given the same task with one significant advantage. They're told that they can actually mount their tracking system up on the merry-go-round. Well, which design team would you rather be part of? Obviously, if you're trying to track a rotating object from that same reference frame, all the sine waves and the sine profiles, they drop out of the equation. And all you have now is a slower moving-- essentially, a DC target instead of an AC target to track.
So let's apply this to our AC motor. It makes a lot more sense-- instead of trying to regulate those currents in a stationary reference frame, let's jump up on the rotor, from that rotating reference frame, and do the current regulation there. That means that the PI regulators that we use can actually be a lot simpler and don't have to worry about tracking nearly as fast of a target.
So let's take our alpha and beta currents and represent them in another coordinate system that's actually rotating synchronously with the rotor flux. The most common orientation of this rotating reference frame is where one of the axes is lined up directly with the rotor flux angle. That's why that particular axis is called the d axis. And then the quadrature axis with respect to that is called the q axis.
The process of doing this is referred to as the forward Park transformation. And as you can see, it involves a little bit more math than the forward Clarke transformation. Now we need to take the angle of the rotor flux with respect to the A magnetic axis, and we have to do some trigonometric calculations with that. It turns out that these calculations very rarely involve doing a Taylor series expansion, or something like that. In most cases, you just simply use a lookup table that's in memory to derive those angles. But still, it does require a little bit more math than the forward Clarke transformation.
So here's an animation that shows the Park transformation in action. And what you'll see here is that under steady state conditions, in other words, the amplitude of the current vector isn't changing, that that will result in DC quantities on both the d and q axes. And these values are a lot easier to regulate than values that are moving sinusoidally.
So finally, we're at the point where we're ready to regulate our currents. And we see that we have our motor currents transformed into equivalent d axis and q axis currents. And the question now becomes, well, what do we want to command for the currents for the d axis and the q axis?
Well, keep in mind we said earlier that we would like to have all of our stator current vector to be 90 degrees with respect to the rotor flux. That would indicate that the commanded value for the d axis current should be zero. We don't want any of that current vector to be on the d axis. We want it all on the q axis. And what should we select for the commanded value of the q axis current? Well, that's actually the torque that we want the machine to generate.
For example, let's consider an electric vehicle application. Now, many people think that when you push down on the accelerator pedal, that you're actually commanding speed. That's not true. When you push down on the accelerator pedal, even with a combustion engine, you're commanding torque, not speed. So with an electric vehicle, let's say you have a potentiometer hooked up to your accelerator pedal. The value off of that potentiometer, it runs right here into the q axis as iq current.
So we essentially have two current regulators. One for the d axis, and one for the q axis. And we're now done with step two.
Step three is that we take the error signals that we calculated in the previous slide, both for d and q axes, and we amplify them. And in this case, we show PI regulators being used to do that function. It turns out that due to the nature of the poles in the transfer function for most current regulators, that we don't need additional phase compensation. So we don't need a PID regulator, unless, of course, you're sampling frequency is really low, or there's other things in your system that are causing phase delay.
But in most cases, a PI regulator is sufficient to do that. So what we're doing in this case is we're generating two correction voltages now. One for the d axis, and one for the q axes. Once we finish this step, we're ready to proceed to the fourth and final step.
If you've made it this far, congratulations. Now, just hang in there for a little bit more, because we're almost done.
Step four is to take these two voltages and apply them to the motor terminals. But wait a minute. We can't apply vd and vq directly to the motor terminals for a couple of reasons. Number one, these values exist on a rotating reference frame. If we're going to apply them to the stator coils, we need to transform those back down to a stationary reference frame. And then the second reason is we only have two values, vd and vq. We need three values, because, remember, we have a three phase machine.
So there's a couple of steps that we've got to go through yet, and the first one is the reverse Park transformation. Now, this is the one that gets you down off of that rotating reference frame, back into a stationary frame. So we're going to turn vd and vq into v alpha and v beta, which are a stationary reference frame. And the equations required to do this look very similar to what we used to get up onto the rotating reference frame. We have the same cosine and sine calculations that need to be done. And once again, we can use a lookup table, just like we did in the forward Park transformation.
So here's an animation that shows this process. And once again, we see that for steady state vd and vq values, that that translates into sinusoidal alpha and beta coordinate values.
So once we have v alpha and v beta, we see that they form a voltage vector. And the goal is to come up with three equivalent voltages on a three phase reference frame, which will generate exactly that same voltage vector. And this is shown here as the reverse Clarke transformation. You can see that the equations are very similar to the forward Clarke transformation. There's a few more multiplies and additions, but still, it's something that can be quickly calculated by most processors.
Once I have these three voltages, I simply scale them appropriately and apply them to my modulator, whether it be a PWM module, or some kind of space vector algorithm, or whatever. And that's it. We'll see that over time, under steady state conditions, that these three voltages will turn into three phase sine waves that are phase shifted by 120 degrees.
At that point, I fall through the bottom of my interrupt service routine, and then I wait for the next interrupt, where I go do the whole process over again. And by that time, the rotor has moved to a slightly different angle, my currents are a little bit different. Hopefully, the currents are different in a way that they've moved closer to the desired values that I want. And then I just repeat the whole process over again.
So here, you can see how field oriented control is commonly done. Once again, I sample the A phase current and the B phase current. I add them together, and then negate the result to achieve the C phase current. Now, I've taken the liberty of lumping the Clarke-Park transforms together for clarity's sake. So I take iA, iB, and iC, and I transform those into id and iq. And those are essentially DC values. So I'm doing the regulation actually in a reference frame, if you look at it on a scope where those values are not changing very rapidly at all, at least under steady state conditions.
So I do the regulation there to generate vd and vq correction voltages. I then run back through the reverse Clarke-Park transforms to generate my phase voltages to drive the machine with.
Here, we see a typical example of a field oriented control system. The top block contains all of the power electronics, and the bottom block is actually one of our processors. That's the 2803x device, commonly known as the Piccolo. And let's talk about a couple of things on this part that I think are relevant to this application.
First of all, you'll notice that the signals from the quadrature encoder mounted on the motor shaft are decoded directly by a module on the Piccolo part. So there's no reason for an external decoder to sit out there between the encoder and the processor. That's all done on the part where we actually take the quadrature signals and decode those into a position variable.
The next thing to notice is that the PWM module actually has a sync pulse, which is used to trigger the 12-bit A to D converter. And this is important, because you need to acquire your current readings at exactly the right spot within the PWM cycle, and the timing can be so critical that you can't rely on software in many cases to do that for you. So having a sync pulse, where you can actually sample the currents at exactly the optimum value in the PWM cycle, is very important to motor applications.
Now, if you look inside the processor block, some of the individual blocks are red, and some of them are purple. It turns out that the hardware modules inside the processor are shown in red, and the software blocks are shown in purple. And if you look at the way that this field oriented control algorithm is hooked up, it's actually part of a cascaded control loop, where we have a speed loop wrapped around it.
So what we're doing is we're taking the actual speed, comparing it against the commanded speed, and generating an error signal. And that becomes the torque command for the field oriented controller. So if we're going too fast, for example, then we need to have less torque. Or if we're going too slow, we need more torque. So this is actually a very common way that this is done.
Now, Texas Instruments has several reference designs available that do field oriented control on the Piccolo processor. We have reference designs for permanent magnet synchronous motors, and also for AC induction motors. So if that's something you'd be interested in, please visit our website, www.ti.com/motorcontrol, and you can have access to those reference designs.
Another great application for field oriented control, which is actually gaining in popularity, is electric power steering. And what we have is a torsion bar mounted in the steering column, which generates a different angle from one end of the bar to the other end the bar, as a function of how much torque is being applied by the steering wheel. So that torque signal is applied to a processor, which is implementing field oriented control. And that's used to drive a permanent magnet synchronous motor, which is hooked up either to the rack and pinion directly, or in the column of the steering wheel, to provide torque assist when you turn the steering wheel.
Now, as I mentioned earlier, using a resolver or an encoder on the motor shaft to get rotor flux angle information is very expensive. But we've also seen, as we've gone through the field oriented control process, that having that rotor flux angle is absolutely a critical piece if we're going to do field oriented control. So we need to find another way to get that information without having to have a shaft sensor. And that serves as a launching point for a discussion on model based filtering.
So what I have here is I have a process, which is generating some kind of signal. Unfortunately, I can't get to that signal, because it's buried down inside the machine, or it's contaminated with noise. The only measurement that I can achieve is the signal after it's been contaminated with the noise.
So what I can do is I can build a mathematical model of my process, and generate an estimate of what I think that signal should look like. I then compare it to the measurement, generate an error signal. And that error signal is used to correct my mathematical model, so that on the next iteration, I can generate an estimate that should be closer to my desired signal.
One of the simplest instantiations of this concept is something called the tracking filter. Or maybe you know it by a different name, the alpha beta filter. And this filter really works best when you're trying to process a low passed signal in the presence of broadband noise. This particular filter consists of two cascaded integrators, where the second integrator is actually making an estimate of what we think the signal should be.
So you can see the measurement coming in. This is the one that has the noise plus the signal on it. I compare that to my estimate and generate an error signal, which then goes back and biases up the inputs of those integrators by two amplification factors, which are the alpha and beta blocks.
So if I want really good tracking performance out of this filter, I can dial up alpha and beta so that they're high values. Unfortunately, that means I'm also going to be tracking more of the noise as well. If I want more filtering, I can bring those levels down and get better filtering. So it really is a trade off of good filtering versus good tracking.
Now, not long ago, I was doing some modeling with the tracking filter, and I wanted to put it in a form that could be processed by Mathcad. So I went through and twisted the equations, and what I came up with was the form that you see before you here. And what I realized at that point was that the tracking filter was nothing more than a simple second order infinite impulse response filter.
Well, you can imagine my disappointment, because I had always thought that the tracking filter was something rather significant, or something special, and here, come to find out it's nothing more than a simple low pass second order IIR filter. But as I thought about it some more, I realized why we like to represent this filter as two cascaded integrators. And you can see that in the next slide.
Once again, we see the tracking filter represented in the cascaded integrator form. And what we see is that by representing the filter in this format, it actually produces the derivatives of my controlled variable for me. For example, let's say that I'm trying to track a measured position. That means that the output of my second integrator is going to servo in to the estimated position. Now, if my filter is operating with relatively low error, and the output of that integrator is the measured position, then it forces the input to that integrator to be the velocity of the system.
Now, that's really cool. It actually morphs the signal to become the velocity signal. And if that is the output of the first integrator stage, and again, we're operating with relatively low error, then it causes the input to the first integrator stage to be the system acceleration. So by representing the tracking filter in this format, I get a lot of useful signals out of it that represent valuable things in my system. Now, how cool is that?
Well, despite how nifty the tracking filter is, it does suffer from one rather serious problem. And that is, since it's basically a low pass filter, then it exhibits phase delay, just like all low pass filters do. In other words, if it's tracking a particular signal, it can't start responding to changes in that signal until those changes actually occur. And this is a problem.
To illustrate what I'm talking about, let's take a look at this animation. So you're going to be in the red car, and you're following this truck. So your job, as a tracking filter, is to track the position of the bumper of that truck, and maintain that distance between your vehicle and the truck.
Unfortunately, you can't see through to the traffic in front of the truck. All you can do is just track the position of that bumper. So even though the traffic ahead of the truck may be slowing down, you can't respond to any of those changes until the truck itself actually puts on its brakes, at which point, there's going to be a delay while you put on your brakes. And as a result of that, maybe some bad things are going to happen.
So let's rewind this scenario, and this time, instead of following a truck that you can't see the traffic ahead of it, you're going to be following a car. So you're still trying to track the position of the rear bumper of the car ahead of you, but now you have an additional piece of information. You can see the signal that is stimulating the system that you're trying to track.
In other words, you can see the traffic conditions up ahead of the car, and knowing something about how that car will respond to that perturbation, you can actually simulate that response, and therefore, minimize or completely eliminate the phase delay of your response. In control systems, this effect is called feedforward compensation. In other words, you're feeding forward some of the input signal of the system that you're trying to track in order to minimize phase delay.
So let's take a look at the structure of our tracking filter again. But this time, we're going to add a feedforward component. So here we can see a tracking filter that's used to model the mechanics of a system that's used in a servo application. And just like we saw in the previous slide, the same signal that's stimulating our control system is also fed into the model of our tracking filter as a feed forward signal.
Now, when you do this, the tracking filter goes by a different name. It's now called an observer. And observers are used very frequently in motor control systems where you want to minimize, or completely eliminate, the estimation lag of your tracking filter. So let's take a look at an example of how an observer can actually do something useful for you in a control system.
Now, in this particular example, the output position of the servo system was measured with an encoder. And with any positioned servo system, you also need to measure velocity in order to make your system stable. So how do you get velocity information off of an encoder signal?
Well, one of the easiest ways to do it is to measure how many encoder counts occur over a specified period of time. But the problem is, what do you do when the motor's going very, very slowly? In most cases, you want the time interval to be the sampling interval of your control loop. So when the motor's going really slow, you end up with a situation where you may only get one coder count per interval, or two encoder counts per interval, or maybe zero encoder counts per that interval.
So your velocity signal has become extremely quantized. And if this is the signal you're trying to measure, you can think of it as being contaminated with quantization noise. You really don't have access to the velocity signal directly. You can only get the reading after it's been contaminated with this quantization effect.
But have no fear, because the observer can create that velocity variable for you. By forcing the output of the observer to track the servo position, in other words, the encoder count value, it forces that input to the last integrator stage to morph into the velocity signal. And that has as much resolution as you want it to have.
So let's take a look at a simulation example where, in one case, we derive the velocity signal from the delta encoder count values, and in the other case, we derive the velocity signal from an observer.
This slide shows the simulated position, velocity, and currents of a servo system where, at t equals five milliseconds, I have commanded a step change of one revolution, which is 2,000 encoder counts. In particular, take a look at the velocity signal. So you can actually see what the actual velocity is. That's the cyan colored graph in the middle there.
But look at the difference between the velocity which has been reconstructed from the encoder, and also the velocity that's been reconstructed from the observer. Notice how much smoother the observer velocity variable is. And especially when you get out into the tail end of the movement, where I'm not going very fast, you can actually see the encoder quantization problem that I was referring to.
And when you feed the output of your velocity loop to the input of your current loop, look at the current perturbations that that causes when you use the signal reconstructed from the encoder. There's lots of noise on that signal. And actually, if you've done anything with encoders, you've probably heard this effect before. It sounds like a scraping noise, or something, on your motor, as it's moving very, very slowly. And again, take a look at the current wave form when the velocity is reconstructed from the observer. It looks much smoother, and that results in much quieter operation of your motor.
This slide shows the actual observer that I used in that simulation. And the topology of this observer comes from some of the work that's been done at the University of Wisconsin in Madison. So you can see that the output position of my servo, the pos_vo variable, is fed back to the input side over here, where it's compared to the encoder counts. That generates an error signal, which is then fed into a PI control loop.
And this is actually the negative feedback part of the observer, and that's used to correct for any unforeseen perturbations to the system that aren't accounted for by changes in the input control signal. So for example, any torque perturbations, or things that couldn't be accounted for, that's actually handled by the feedback path here.
And then you also see the feedforward path. Now, this is the input signal coming into the observer, which is my current wave form. And again, that feedforward path is included to minimize the phase delay of the observer tracking performance.
So let's get back to our original question, and that is, how can we use an observer to get rid of the shaft censor, so that I can actually use an observer to measure the angle of the rotor flux? So I've got a three phase machine here, and let's assume that I've already done a Clarke transformation on it. So I've essentially turned it into a two phase machine, where I now have a sine coil and a cosine coil.
So look at this circuit diagram right here. This circuit is actually common to both the sine and cosine coils. And if I write the voltage expression for both of those coils, it's actually this matrix expression which is shown right here. And all this says is that, basically, the voltage which is applied to any one of those coils is equal to the sum of all the voltages around the loop of those coils.
So let's just take the alpha coil, for example. That's the top variable. v sub alpha is equal to the ir voltage drop across that stator resistor plus ldidt, where P is my differential operator in this case, plus another term, which is the back EMF component of my machine. And that's basically proportional to a back EMF constant times the speed that the machine is going, times either this sine or cosine term right here.
So in this expression, where do you see anything related to shaft angle? Well, it turns out it's actually in the back EMF signal. You can see it's sine of theta or cosine of theta. That's my angle information. That's what I need to somehow extract. But unfortunately, the back EMF source is buried deep down inside the motor. I'd love to be able to just stick a voltage probe on it, and get that signal directly, but I can't. So I need to use an observer to extract that signal for me.
So here's how you make a back EMF observer. I'm going to start by reproducing the stator circuit here for one of the coils. And what I want to do is I want to find the equation which would define what the current is flowing through this coil. So I can basically represent that as a steady state term, which is shown here, times the transient term effect, which is shown here.
And if I actually model that, if I create a block model of how to implement this, it's basically taking my input voltage, subtracting my back EMF voltage, which, by the way, I don't know what that is yet, but nonetheless let's include it here for now. Once I have that difference, then I divide by my stator resistance, and then I run it through a single pole low pass filter. So that's actually how I would represent this equation.
So let's take this block, and let's copy it up here. Now, you'll notice that my resistance variable has a hat over it. That means that's an estimated variable. That's my estimate of what I think the stator resistance is. Keep in mind that this motor is heating up and cooling down, so its resistance is changing all over the place. So what I'm entering here is basically a value that I had measured previous, at some time in the past. And then I'm going to have a digital low pass filter, and I'll show you how to implement that in just a second.
So what comes out of that is my estimate of what I think the current should be. Now, keep in mind that I can actually measure the current in this coil. What I can do is take my three phase current measurements, and then do a forward Clarke transformation on those, and get i sub alpha and i sub beta. So once I have that value, I'm going to compare my estimate of my current with the actual measurement that I've taken, and generate an error signal from that. I'm going to then take that error signal, and gain it up through a PI control loop, and then I'm going to invert that signal. The reason for that will become apparent in just a second.
So now that I have that output, what do I do with it? Now, watch this. I'm going to take that output, and I'm going to wrap it back around into this input to force it to become the missing back EMF variable. Now you see why I needed to multiply that term by a minus one. Because if I didn't, I would have positive feedback through my whole loop instead of negative feedback.
So here's how it works. Since this is a closed loop system, if I can make my gain high enough in my closed loop system, I should be able to drive this error term to zero, or pretty close to zero. What does that mean? That would mean that my estimate of my current is actually equal to the real value that I measured. But the only way that that could happen would be if the output signal actually turns into the back EMF signal. So you see it actually morphs that output into the back EMF signal. It's pretty clever.
So here's a simulation that I put together showing how you build a back EMF observer. And it actually consists of four blocks here, and we'll go over these individually. This block down here at the bottom, that is my estimator, where I'm actually trying to estimate what I think the motor current should be. This is my actual motor phase. And from the output of that, I actually do have a measurement of the actual motor current in that phase. This block over here, that is my regulator. You can actually see the PI components in here. And then over here-- this block right here is my power stage. And that's where I'm doing my PWM modulation.
So let's actually zoom up on some of these, and take a look at some of this stuff. And you can hopefully see a little bit better. Here we go. So here's the voltage coming into my motor phase. It's got a series resistance. It's got a series inductance. And then here is my back EMF generator. Now, this is what I'm trying to figure out.
Now, I know what this is, because I'm the one that programmed the simulation. But the rest of my circuit doesn't know what this is, and of course, the goal will be to see how well my simulation can reconstruct what this signal is. And then the output of this block-- all I'm doing is creating a voltage source, which is a function of what the current is flowing through this resistor right here, R1. So that's being output right here as the actual motor current.
Let's go down below here. And here is my single phase motor model. So here, I have my voltage, which I'm applying to the input of the winding. And then this is the input for the back EMF, which I don't know what it is, but that actually would get subtracted off from the input voltage to my winding. And then that goes through a low pass filter, just like I talked about earlier.
And this is the way I create the low pass filter. It actually has an integrator inside of this. It's a digital integrator. And all of the digital components are driven by this sample clock, and that's shown right here. This is actually programmed to work right now with a sampling frequency of 10 kilohertz. So that sample clock, it's just a pulse generator that feeds all of my digital control blocks, like my sampling hold, my z to the minus one terms, things like that.
Let's move up here. Now, here's the input voltage that I actually do want to drive the motor winding with. And this is just a sine wave that's running at a variable called freq, or frequency. And that's, right now, set to 60 hertz. And I'm going to apply that then to my power stage, where it gets modulated. So then I'll just have a PWM signal with a low frequency modulation on it of 60 hertz that I'll be applying to this voltage input of the winding.
And then the last piece we want to look at here-- this is the PI regulator. So I take the actual current that I've measured, I compare it to the current that I've estimated, subtract the two, generate an error signal, and then you can see it goes right into the PI control loop. This is the i term on the top, this is the p term on the bottom. Those two outputs get summed. And then, like I said, I have to negate it, otherwise I end up with a positive feedback.
So let's hook all this up, and if I do it right, it should actually simulate that back EMF signal. So my voltage input-- I'm going to feed that down to the input on my model here. There we go. And I'm also going to take that and supply it to my PWM module, so that I can actually create a PWM signal to drive my power stage right here. And then the output of my power stage-- I'm going to take that and run it into my voltage input on my motor coil.
And then this is my actual current that I've measured. So I'll feed that into the reference input here. And then I'll take my estimate of the motor current. I'm going to feed that in right on the other side here. And then the last piece that I have to hook up is to take this output, which I'm hoping is going to morph into the back EMF signal, and wrap that back around to this input like we talked about earlier.
OK. So if I've done everything correctly, let's fire this up and see what happens. So when I hit Run, you can see my model servos in on the actual back EMF signal very, very quickly, and then immediately, it's tracking it. So this stuff really does work. Let me go ahead and stop this here. And you can see just how well that my model is tracking this mystery back EMF signal right here.
You know, I've tried all kinds of waveforms. I've tried square waves, I've tried triangle waves. And again, depending on what the gain that you have set in your PI loop-- it'll track just about any kind of waveform. So again, this stuff really does work. It's not black magic.
As incredible as the observer is, we're not out of the woods yet. All we've done is recreate one of the back EMF signals. And remember, what we started out to do was to try to find the angle of the rotor flux.
So this slide shows the whole process of how we used two back EMF observers to do that. The top circuit is for the alpha back EMF signal, and then the bottom circuit is for the beta back EMF signal. And then we have those two signals. One is a sine wave, one is a cosine wave. We supply those to this output block right here, which is an angle demodulator. And what pops out on the output of that thing is an estimate of the angle of the rotor shaft, and from that, I can determine what the angle of the rotor flux is.
So you can see we went through an awful lot of steps just to get that angle of the rotor flux. And then once we have that, we can proceed with the rest of our steps in field oriented control, just like we talked about earlier. Step two, step three, step four, and so on. So getting that angle is a very, very big part of this whole process.
Here's a simulation of the previous slide showing both back EMF observers, plus the angle demodulator. So let's just start over here. This, right here, is my three phase power stage. So I have va, vb, and vc. So I'm actually creating PWMs, that I'm driving all three of my motor windings with. And then you can actually see those here. Here is phase A, phase B, and phase C. So what I'm doing is I'm essentially sampling the phase A and phase B currents, and then I run through the forward Clarke transformation right here using all three currents. And right here, I create i sub alpha and i sub beta.
So this, right here-- whole block. This is my back EMF observer for the alpha circuit, and then here's the back EMF observer for the beta circuit. The outputs over here are my estimates of the actual back EMF signals. And again, I'm keeping those a mystery to the rest of the simulation. So it's up to the observers to try to figure out what those signals are once they've been transformed into a two phase coordinate system. Then I have those two variables. I feed them both in to my angle demodulator down here.
And let's just pop this open real quick. We can take a look at it so you get a better idea of what this is. So again, here's the angle demodulation. I'm kind of doing a heterodyning operation by wrapping the output back, and multiplying the sine term by the cosine of the estimate on the output, and then vice versa. The cosine term by the sine of the estimate on the output.
So this is a two stage back EMF observer. It has two integrators in it, so it's second order. And this is my estimate of my angle. This is what I think the angle is. And of course, if that's the angle, and that's the output of this integrator, then that means that this variable on the input of the integrator has to be my frequency. So I can actually get a very good estimate of what the frequency of my system is as well.
Now, I know what the actual angle is, because I know what frequency that the back EMF signals are running at. And I can multiply that over time to get the actual angle value. I compare that to my estimate of the angle value, and then I can generate an angle error, which I'm going to plot to see how well my whole system is actually following that real angle.
So let's go ahead and back out of this. And I'm going to start this thing running. And let me zoom this up right here. What you see on the top are four waveforms. Those are the true alpha and beta back EMF signals. And right on top of those are my estimates of the back EMF signals. So you can see it's tracking very, very well. The bottom plot right here-- this is actually showing that I start off with an error of minus four degrees. It then jumps up to eight degrees, but then it starts servoing right in to the actual angle. And then you can see the frequency estimate, which is the variable right before that last integrator, going right in to 60 hertz. So I have a nice filtered version of my frequency as well.
Now, if we let this thing run a little bit longer-- actually, at 50 milliseconds, I changed my stator resistor without telling the observer what happened. So I'm actually estimating my signals with the wrong value of my stator resistance. And you can see that my observer now can't follow the back EMF signal quite as good. And as a result of that, it does result in an angle shift. So that's what you have to watch out for. When your parameters change, and you don't know about it, you start getting wrong answers for your angle estimate.
And then right at 100 milliseconds, I changed the resistance by a factor of two in the other direction. So at 50 milliseconds, it's a factor of two in one direction, and then a factor of two in the other direction at 100 milliseconds. And you can see, once again, that that does cause another shift in my estimate.
So once again, we can see that this stuff really does work. And I would encourage you, again, if you get a chance, to try to build one of these or play around with them. They're really a lot of fun to experiment with.
TI has a very interesting reference design where we do sensor-less field oriented control on two permanent magnet synchronous motors at the same time. And that's what this slide right here is showing. The processor that does this is called the Piccolo, and I've already talked about that, or alluded to that, in this presentation earlier. We actually use something called a sliding mode observer. It's a little bit different than the one that I discussed here, but basically, it does the same thing. We're trying to estimate what the angle of that rotor flux is.
Now, here's what I find to be fascinating about this reference design. We are controlling both motors using sensor-less field oriented control, and the sampling frequency for both of those algorithms are running at 10 kilohertz per motor, yet the combined bandwidth required for both of those algorithms, for both axes, never exceeds 50% of the CPU's bandwidth capability. I mean, that's just amazing. That shows exactly how powerful the Piccolo is in doing algorithms like field oriented control. And again, we have enough PWMs on it to control both motors. We actually have 14 motor control PWMs, which include dead time and all that other good stuff that you like to see when you're controlling a motor.
Here's a slide showing the roadmap for our C2000 family of products. And you can see that the roadmap is actually split into two distinct parts. On the bottom end, we actually have the Piccolo series that I was talking about. That's the 2802x and the 2803x devices. And these are focused more at the lower cost, 40 to 60 MIPS kind of performance ranges. And again, like I already illustrated, that's plenty good enough to do a field oriented control on most motors.
But if your application actually requires more processing power, then you might want to consider the 2833x family, which is 150 MIPS and 300 megaflops. These are floating point processors. Or even higher than that is the 2834x family. These are 300 MIPS, 600 MFLOP machines.
So you can see here that TI has a wide range of solutions, and there's a pretty good chance that your application is going to be covered by one of these products.
Here, you can see a more complete list of some of the reference designs that we've generated for motor control. And I'm not going to take your time now by going through all of these, but I just wanted to make you aware that these exist. If you'd like more information on these or other reference designs, again, please visit our motor control website. It's www.ti.com/motorcontrol.
Well, we've reached the end of our presentation, and I really do appreciate you spending the last hour or so with me as I've talked about field oriented control and some of the solutions that TI has to implement this technology. You know, when I think about all of the different topics in motor control, I think that field oriented control is perhaps my favorite, and I hope that you've enjoyed it as much as I do. If you need to get a hold of me, please see the information at the bottom of the slide. My email is davewilson@ti.com, or you can call me at the number that's listed there. Again, thanks for your attention, and I hope to see you in another seminar real soon.
This video is part of a series
-
Delfino™ premium performance MCUs
video-playlist (14 videos) -
C2000™ MCUs - motor control
video-playlist (48 videos)