TI Training home
C2000™ MCUs - Motor control
Teaching old motors new tricks with C2000™ Field oriented control of permanent magnet synchronous motors
C2000™ MCUs - Motor control
3.2 Field oriented control of permanent magnet synchronous motors
Let's go ahead and try to get going here again. My apologies for the technical difficulties that we're having. My computer for the last, like, three days, all of a sudden it will just start overheating, and then it just shuts off. I don't know why. So if it does it again, we've got the files back there for Richard and we're going to use his computer to complete the presentation. Either way, you're going to get trained. I mean, it's like just because it's a snow day doesn't mean you can stay home. We're going to make sure you get this material, and that you're going to understand how it works. Actually, that was probably an opportune time to take a break, because now that you're refreshed and everything, it's really important, I think, to understand this part of the presentation, because it is so critical to everything that we do in motor control.
So a couple of questions that were asked before the break, which I think were very good questions-- show us what's happening here. And that is the fact that our current sine waves are synchronized in frequency to whatever this rotor frequency is. If this all of a sudden instantly stopped, the sine waves would instantly stop. OK? They're perfectly synchronized in frequency-- not only in frequency, but in phase. We have to have the phase relationship just right with respect to the rotor angles. In other words, these angles with respect to the rotor angle are designed in such a way so as to always cause a current vector which is 90 degrees with respect to the rotor flux. And I think that was kind of what was the heart of the issue for a lot of the questions that were asked right before the break.
OK. So let's establish some conventions. First of all, what we're talking about here is when we look at the motor itself-- and let's just pretend that this is the cross section of a motor frame-- we're going to be referring to that as a space vector diagram, where we have-- this is the magnetic axis for phase A, this is the magnetic axis for phase B, and of course this would be the magnetic axis for phase C. And we have the current waveforms-- again, you can see this-- in such a way so that the rotating vector-- now this could be voltage, it could be current, it could be flux, whatever-- we're going to represent all those vectors on the space vector diagram. Keep in mind this is spatial, spatial representation with respect to the motor's cross-section. This is not phasor representation. This is spatial representation, which is why it's called space vector representation.
So if this is voltage or this is current, you can obviously see that this vector, like right here when it's right at the peak on B, that would be right here where it's at the peak on B. Right here, you can see as it goes to the peak of A, it's coming up right here on the peak of A. It's synchronized in such a way that we're always going to represent these three-phase waveforms in time as some kind of rotating vector.
And the representation that's most commonly used is to use what's called the right hand curl rule, if you will. If this is the front of my motor right here, I can establish which direction positive rotation is. So positive rotation is if this is coming out from my motor shaft, my thumb is pointing in the direction of the motor shaft, positive rotation is going to be clockwise. This would be positive direction, positive rotation, positive speed, positive torque. If it's going clo-- what's that?
I'm sorry, counterclockwise. Right. Thank you. Little editor's note there. Yeah, well sometimes my world is flipped backwards, you know. But I'm glad you caught that one, because that was supposed to be counterclockwise. If it's going clockwise, of course, that would be going in the negative direction.
And here you always see that phase A leads phase B, phase B leads phase C, and phase C leads phase A. Kind like rock paper scissors, all right? So you've got that relationship that's established.
Having that as our convention, this is hopefully going to clear up some confusion that oftentimes arises when you interpret the equations for this, because in Europe sometimes they represent things differently. Instead of having this axis right here as positive, they'll have this axis as positive, and that means all the equations get twisted around. So just again, I wanted to show this slide to show you this is the convention that we're using. Positive alpha is in this direction. Positive beta is in this direction. And we'll show you what alpha and beta are in just a second.
All right. Let's get into this. This is now we're going to start getting into the heart of how this actually works. Now, in order to understand field-oriented control, I like to start with an example of how do you do port control on a DC motor. And the reason I do this is because in most cases, people can understand how to do torque control on the DC motor, and I'm going to use that as a springboard then to explain how field-oriented control works.
So here I have a negative feedback base system. I have a brush DC motor. And I want to do torque control. So what is the parameter of the motor, which is related to torque? It is the motor's current. So I need to measure the motor's current, feed it back into my system right here, and I can basically summarize how to do torque control in four easy steps.
Number one-- and bear with me. This may seem overly simplistic, but I think you'll see why I do it this way when we get into field-oriented control. Step number one, measure the current that's already flowing in the motor. That's what exists right now. We go out and sample the current in the motor with a shunt resistor, with a Hall effect sensor, or a LiM sensor. Whatever you want to do. We need to know what is the current that's flowing.
Step number two, compare the measured current with the desired current and generate an error signal. Just going around the feedback loop now.
Step number three, amplify the error signal with some type of controller or control algorithm to generate a correction voltage. Now you notice, we're trying to control the motor's current. The way we do that is through the motor's voltage. If I want more current, I increase the voltage. If I want less current, I decrease the voltage.
And then finally, step number four, modulate the correction voltage onto the motor terminals via PWM or space vector modulation. There's a number of different modulation techniques that you could use.
But when you do these four steps-- let's imagine these as discrete steps in an interrupt service routine. Once you've done that, you hit your return from interrupt instruction and you go back into your background code to blink LEDs or whatever you think is important at the time. Maybe another 100 microseconds, you'll get another interrupt. And you're going to go back into that loop and you're going to do these same four steps again, over and over and over. And of course, as you do this, hopefully what's going to happen is the measured current will converge onto the desired current value. All right.
And another thing too that we don't have to worry about is any kind of orientation of the rotor flux with the stator flux in a DC motor, because field orientation is accomplished mechanically. We have a commutator and brushes, which are designed in such a way that it does the field-oriented control for us automatically. So I'll even argue that a DC motor does field-oriented control. It does mechanical field-oriented control via brushes and a commutator, and the vector is not rotating. It's stationary. But believe me, it's still field-oriented control. We want the rotor flux to be perpendicular to the stator flux.
Now, let me ask a question just to make sure you're all on board with me. Does everybody understand those four steps? If you understand those four steps, then I think you will understand field-oriented control, because I'm going to use exactly those same four steps to show you how to do field-oriented control. All right? Are you ready?
Step number one-- well, I mean, I've got one slide to go before I did that. My big intro just kind of fell right there, because I want to show you that for an AC motor it's exactly the same thing. Step one measure, the currents already flowing in the motor. Compare the measured currents with the desired currents. Amplify the error signals to generate correction voltages. And modulate them onto the motor terminals. That's how we do with an AC motor.
So now, step number one. Measure the currents that are already flowing in the motor. This is an AC motor. Well, I've got three currents now that are flowing instead of one. So what I'm going to do here is use some kind of sensors-- shunt resistors, whatever-- and I'm going to measure two of the three currents. Why do I not need to measure the third current? Anybody know?
Kirchhoff's current law. Exactly. What does Kirchhoff's current law say? Do you remember?
That's right. All the currents flowing into a node have to sum to equal 0. Well, if we refer to this as a node and it's isolated from anything else-- there's no other electrical connections to it-- that means that the sum of the two currents flowing into phase A and phase B have to equal what's flowing out on phase C. There's no other way to get around it. Doesn't matter whether it's a balanced load or anything else. It's just simple current, the way that it works. So if I measure these two currents right here, I can now calculate what IC is by adding these two together and taking the negative of it. And that's IC.
Now sometimes in industrial controls, you do see that they have three current sensors. Any guesses as to why? A lot of industrial motor drives will have three current sensors.
Yes. Both of you are right. If I have a winding to frame short, guess what? That law is broken, and then I can use my third current sensor to say, whoops, we are not seeing the right current. Therefore you tripped the fault light, bring the drive down to a safe state, and then flag the technician to say go replace the motor. OK?
So-- but for the algorithm that we're talking about to work, I just need two to calculate what the third. And you can see what I'm going to do is take each one of those currents. Now, these are just scalar numbers. Right now I don't have any vector representation associated with them at all. I just run them into an A to D, and the A to D just makes a number. Figuratively speaking, what I'm going to do is take the number for the A current, and I can reflect that along the A axis-- the A magnetic axis of my machine. All right? Then take the B current, and I reflect that along the B magnetic axis.
Keep in mind I'm talking about three coils, and those coils are spatially oriented inside the motor separated by 120 degrees. So if I have a current flowing in phase A, it's going to cause a magnetic vector in this direction. A current in phase B is going to cause a magnetic flux in this direction. What about phase C? I take this number, add this number to it, and take the negative of it, which means I'm going to have negative phase C current, as shown here.
Now, if you look at all these three current vectors, they're kind of all pointing in the same direction. And when I add them together vectorially, they're going to end up with a net current vector. If you take all these, you can kind of see it, how they add up create this net stator current vector. This is the current vector that we would like to be at 90 degrees with respect to our rotor flux. All right? So we've just now taken all three of our currents. We've added them together. And you can see we have a net current vector. And that's it for step number one. You with me?
Step number two. Compare the measured current vector with the desired current vector and generate error signals. Now this step, step two, is where the bulk of field-oriented control is going to be done. We're going to spend a lot of time on this. But at any point in the slide you can look up to the top of the slide and see exactly which step I'm on. It's always still step one, two, three, or four.
So in this case, here is my current vector that we just calculated in the last slide. But what I want to know is, is that the direction that it should be pointing? Is it aligned correctly? In order to know that, I have to know what the angle of the rotor flux is. So if the rotor flux just happens to be along this axis, well yeah, that looks like a pretty nice 90 degree orientation, and maybe I'm good enough, don't need to have any correction.
But what if the rotor flux is like in this axis? Let's say the motor had moved a little bit since the last sampling interval that I took. Well then, I would really like to have a commanded current vector which is 90 degrees with respect to that. And you can see what I have measured now compared to what I'm commanding is different. I have an error signal I have to deal with. And there's different ways to deal with that error signal, but the bottom line is I need to have some kind of control algorithm which will drive this current vector onto the commanded value for my desired stator current. OK?
So if I look at what the commanded value should be, here I have the equation for that. If I know the angle of my rotor flux-- so right here, that's what the theta-- so lambda right here actually represents-- if I know that angle, this right here defines what the commanded value should be in the time domain for each one of those currents. So as the motor is spinning and that angle is changing, I'm generating, essentially, sine waves on phase A, B, and C that are phase synchronized to the angle of the rotor flux. So how can I do that? How can I design a control algorithm or a regulator system that actually will make my currents converge onto these values?
Well, let's take some simple examples of this. And like I said, in order to make that work, we need to know-- in fact, if I back up right here-- this is critical. If I don't know this, I don't know anything. So I need to know what the angle is of the rotor flux. That is usually represented by some kind of sensor which is on the motor shaft, either a resolver, or in this case it's a discrete encoder that we put on the motor shaft. And we get that information by actually taking the angle measurement of where the north pole of my rotor is facing with respect to the magnetic axis for phase A. That's the way the equations have historically been generated. What is phase A on your motor? It's not any different than phase B or phase C. It's all symmetrical. It's just whichever one you choose to say is phase A, well that's the one that you want to have your equation set up to work right. You'll need to reference your rotor flux angle with respect to that coil. All right?
So here is-- it's an animation which shows how we could do that. In this case, I'm going to use three PI controllers, because PI controllers are good for current control. And what I've done is I've got some kind of implied shaft sensor right here on the motor as it is spinning. You can't see it, but let's assume that this is spinning. It's actually measuring the angle of the rotor flux and feeding it to these current generators. These now then become the reference values of the current that I would like to have my motor phases be.
So I'm going to go out and I'm going to take a reading of each one of the phase currents, phase A and phase B. I add them together and take the negative of it. That becomes the current for phase C. And in each case, I'm going to compare the measured current with the commanded current, generate an error signal to generate a correction voltage that I'm applying to my motor windings in such a way that these values of current will servo to the commanded values. And if I do that, I've done field-oriented control. That's certainly one way to do it. And you can see over time, then, what will happen is these current values will look like sine waves again, as the motor is spinning.
But it turns out nobody does it that way, OK, because there's actually a trick that we can use which will simplify our calculations by 33% by eliminating one of the current controllers. And in order to understand how that works, let's take a look at any vector that we've got here. And in this case, this vector was generated by three separate currents, A current, B current, and of course C current. Now, to represent that current vector in the previous slide, we actually had it summed up as three different regulation problems that we were trying to solve. But how many axes do you need, minimally, to represent any two-dimensional vector spatially? Two. You only need two.
So what it means is instead of representing this current vector as the sum of this vector, this vector, and this vector, I could transform it into an alternate reference frame where I'm going to say, well, it's just the sum of this vector and a quadrature vector. And this is called the alpha frame, and this is called the beta frame. And you can see I end up with the same result. But now I've reduced the representation of that vector into two vectors instead of three now that need to be added together.
What does that mean for my current regulators? Well, now it means that I only have to have two regulators instead of three. This is called the forward Clarke transform. And it's very, very simple to do. All you do is you just say, well, the alpha value is going to equal whatever the A value was, and the beta value is going to equal this expression right here. So if I know the vectors A, B, and C, I can translate those into equivalent alpha and beta quantities. And it looks something like this now.
So here I have my currents being sensed again, added together and negated to create phase C. I now go through a three phase to two phase transformation called the forward Clarke transform to create two equivalent currents, I alpha and I beta, which now I regulate with two regulators instead of three. So I've essentially cut the calculations down by 33% percent. It's a pretty neat trick, right? Yes?
OK. So in 10 years, when we have thousands of processors at our fingertips, would this be needed, I guess? I'm kind of [INAUDIBLE] excited about [INAUDIBLE]. But I mean, in 10 years, do we need to do this kind of thing?
OK. Yeah. So the question is, I'm all excited because I've eliminated one of my control loops, OK, and I've cut my calculations down by 33%. But considering that processors are proliferating in speed and cost, is that really going to be a problem let's say 10 years from now? Is that an adequate summary of your question?
OK. And I would say probably not. OK? But it does make whatever your loop is, regarding what algorithm it's running on, it's going to make it easier to calculate. OK? But here's the real point that I want to make. Nobody does it that way.
So your question in one sense is kind of a moot point, because nobody would actually do it that way anyway, because there's even a better way that we can do it. And now I'm going to get really excited, because this is now we're going to get into how it's done. All right?
In order to illustrate what I'm getting ready to do, I want to use an example. Let's say you have taken your daughter to the park and she wants you to videotape her while she goes round and round on the merry-go-round. So you set up your little video camera here. And as she's spinning, you want to be able to-- let's say, being the electrical engineer that you are, you've designed some kind of automatic tracking system that will keep her in the center of the field of view here. So as she's spinning around on her merry-go-round and she's going round and round, your algorithm in terms of what you're trying to track it's going to be going back and forth in kind of a sinusoidal fashion. Right?
Now, as the merry-go-round speeds up, that means you're going to have to be going faster and faster with your tracking algorithm. You'll probably have to design some pretty expensive components in there to do that. I mean, you could imagine if you're going at, like, 10,000 RPM that this thing is--
Well, maybe not 10,000 RPM.
But if she's going faster and faster, you know, you're going to have to be tracking really, really fast to do that. OK? And that's going to be hard for you to do.
Well, all of a sudden, another father shows up with his daughter and she wants the same thing. Now watch what this other father does. He gets on the merry-go-round with his daughter. Now what does the tracking algorithm look like? It's not a sinusoidal AC problem anymore. It's just pretty much a DC problem. As you're just-- as she's moving, all you have to do which is just barely track the variations in her movement. Well, which way is the simpler way to do it, I guess, is my point.
We would rather do the regulation of the current up on the rotating reference frame than trying to do it in the stationary reference frame that we were talking about before. Because as the motor would go faster and faster, we would generate faster and faster current sine waves that we'd have to regulate against. This way is a lot easier to do. It simplifies the dynamics of my system tremendously. And therefore I can get by with essentially just DC kind of regulators. That's the only frequency range I have to worry about now. Another way of saying it, and I've heard people say it this way, I've turned my AC motor into a DC motor. When you use field-oriented control and you jump up on the rotating reference frame, you turn your motor, your AC motor, into a DC motor, is essentially what you're doing.
So the question becomes, well, how do we transfer up onto the merry-go-round? How do we do that? Because I've taken my current readings in the stationary frame. So I've got these sine waves. How do I get those up on the rotating reference frame? Well, that's a good question. And actually, well, this is just another representation of what I was talking about earlier. Something which is viewed from the stationary frame, if you look at the rotating vector both in the alpha and beta axes, they look something like this if I'm tracking the tip of that arrow. But if I put my little man up on the rotating reference frame, and now I look at the representation of that vector on the and q axis, it's DC. Again, just making the point. I don't want to belabor this. But I want to make sure you get this point, because this is very important.
Here's the thing that you can try during the next break, and this will absolutely convince you that it works. Take the coffee test. And I actually have done this, and it's kind of fun. You might want to try it. Give your coffee a good stir, so that you got some bubbles that are going around and round on the surface of your coffee. And then rotate in the same direction that the bubbles are spinning. You know, just take it and go round and round and round like this. When you hit the synchronous speed of those bubbles, they will stop moving. It'll look like it's perfectly standing still. I actually did this and my wife came into the kitchen while I was doing it and she caught me. And she thought that I was-- well, she knows I'm a little bit crazy, but she thought I'd really gone over the deep end at that point. I explained to her what I was doing. I asked her to try it. She wouldn't do it, though. But yeah. You will see that the bubbles will stop spinning. And the reason, of course, is that you've jumped up on the rotating reference frame and now everything has become stationary. It's become DC.
So finally, here's what I was going to tell you. The way we do that-- and this is the second trick-- is we do what's called the stationary to rotating frame transform, which is called the Park transform. And in order to do that, I'm going to take that vector that was represented as alpha and beta, and I'm going to reflect that on two different axes now. One axis is perfectly synchronized to my rotor flux. This axis is always pointing to the north pole of my rotor. This axis, which is quadrature to it, is always, well, 90 degrees with respect to what the rotor flux is.
So I said earlier that I want all my current vector to be 90 degrees with respect to the rotor flux. How am I doing? Well in this case right here, not very good, because you can see a big portion of my current vector resolves onto the d axis, which means it's not producing any torque. The only torque producing component of current is this value of this green arrow right here. So I would like to have all of my current vector to be on the q axis.
But whatever it is, here's how we represent it. I take my alpha and beta values that I've just calculated and I run them through this expression right here, I alpha and I beta. And I can calculate what is the portion of the current vector which is reflected onto the d axis and what portion of that current vector is reflected onto the q axis. This is what's running in the code in real time when you're doing field-oriented control.
How do you make those sine and cosine functions? Well, there's all kinds of different ways to do it. You could do Taylor series expansion to do the sine and cosine values. That's in fact what we do on our DSPs, on our C2000. We have something called IQ-Math, and in that library is some code that actually will take an angle like that and calculate what the cosine of the angle is and what the sine of the angle is. You don't really need anything that complex for field-oriented control. I think we use that because it's available in our IQ-Math library.
But to really get the kind of resolution and performance that you need for field-oriented control, that sine and cosine could be a simple lookup table. In fact, we have a lookup table in our ROM of our C2000 devices. So you can just go in, use the angle as a pointer into your sine cosine table, fetch the value and say, OK, that's good enough. Or if you want to kind of, like, interpolate between two values, you can do that too. There's a number of ways to do it. But you can actually do it very efficiently without taking up a lot of calculation time to make that happen.
The effect of it is to take these sine waves and turn them into DC waveforms, which are synchronized with respect to the rotor flux. Now keep in mind, we're still on step number two. All right? And this is-- we're building up to the point of building those regulators.
So now that we've reflected those values up onto the rotating reference frame, this is where I do the start of my regulator. I say, well, what is the commanded value for my d axis current. What is it?
0. So I need to regulate my d axis value to 0. What is the commanded value for my q axis current? That's torque. So now I have created a system right here where how much ever torque I want, I feed it directly into this current expression right here for commanded q axis is current. And I measure against that, and I generate the error signals for both axes. I got two regulators now running on the synchronous reference frame. And finally, I've finished with step number two. OK?
Are you with me? That was kind of like drinking from the fire hose there. But you saw what we had to do. We jumped up onto the rotating reference frame and now we're going to build our regulators on the rotating reference frame. And this is such a nice input to have right here. Let's say as an example you're designing an electric vehicle and you push down on-- well, actually I made the mistake one time of calling it a gas pedal and one of these hybrid enthusiasts corrected me and said that is not a gas pedal. That is an acceleration pedal. We don't have gas in our electric vehicle. I'm like oops, sorry. OK. Whatever. When you push down on the acceleration pedal, are you commanding speed or you commanding torque? You're commanding torque. You are the speed loop. Visually you see how fast you're going, and if you're not going fast enough, you push down on the accelerator pedal harder. Right? OK. When you push down on the accelerator pedal, you're commanding torque. On an electric vehicle, using field-oriented control, that potentiometer, wiper, or whatever that's on the accelerator pedal goes right into this q axis commanded current right here. OK? So just an example of how easy it is to use that.
OK. Finally, step number three. Amplify the error signals to create correction voltages. Once again, I'm going to use PI controllers, because of how they work with motor windings. And so I'll have a PI controller for the d axis, a PI controller for the q axis. And what I'm doing is I'm generating correction voltages. This is a correction voltage for the d axis and a correction voltage for the q axis. Now I would like to be able to just apply those voltages directly to the motor windings, but there's two reasons why I can't. Can you think of what they are?
For the software engineer it's always a hardware problem, isn't it? Oh my goodness. OK. So good answer, but wrong. The reason is because I've only got two of them and I need three. It's a three phase motor and I've only got two values. What's the second reason?
I'm on the rotating reference frame. So I got to first of all jump off of the rotating reference frame to get back into the stationary frame. And then I got to take those values and convert them into three voltages instead of two. In other words, the forward Clarke and Park transformations that I used to get here to begin with, I've got to undo them now. So I'm going to do something called the reverse Park transform. And you can obviously see what's going to happen here. I'm going to take whatever that voltage vector is as a result of Vd and Vq. I'm going to resolve that now back in the stationary reference frame as voltages V alpha and V beta.
And the equations that I use to do that look very, very similar to the equations I used to jump up onto the rotating reference frame to begin with. In fact, I can reuse a lot of the calculations that I already did, such as cosine of the angle, sine of the angle. I've already calculated what those are. I can just plug those back into these values right here and multiply by Vd and Vq. And what do you know? I've taken my Vd and Vq DC voltages and turned them back into AC voltages.
Now, if I had a two phase motor, I'd be done. Now I've already generated the correction voltages for a two phase machine. But because I have a three phase machine, I need to go through one additional step, and that is to turn V alpha and V beta back into three voltages, which again is the reverse Clarke transformation. And these are very, very easy calculations to do. This is a constant. This is a-- I mean, they're all constants, so it's basically multiply accumulates, which can be done very, very quickly.
Question in the back? Yes?
Could you please go back to step three [INAUDIBLE]?
Sure. Right here.
Are those basically the same twin type controllers for each of those, or are they--
Like the PI coefficients?
OK. That-- so the question is, when we talk about the PI controllers for the d axis and the q axis, are they the same values that we use for P and d-- or P and I? And also, I guess, the topology. Is it the same topology? The answer is yes and no. It's exactly the same topology, but not necessarily the same P and I coefficients. And we'll get into that a little bit later. If you're dealing with an AC induction machine, an AC machine is very symmetrical, so they would have the same PI coefficients. OK? Actually, wait a minute. That's not true. There's a difference that you have to consider for induction machines as well. For permanent magnet machines, permanent magnet non-salient machines, they're the same. But if you have magnetic saliency in your system, like a special type of motor called an IPM motor, then no. You have to put different coefficients on both those axes. But that is a good question. In fact, that's a question that I didn't even really know the answer to until recently when I started fooling around with this stuff and realized, oh yeah, for certain machines you need to them differently for the d and the q axes.
OK. Any other questions so far? Because I think we're almost done.
I mean, now that we've got our three voltages. Step number four, modulate the voltages, the correction voltages, onto the motor terminals. That's just dropping them into the PWM register. Whatever those values that we have calculated-- and of course we probably want to scale them to be scaled appropriately with the PWM range of 0 to 1. But whatever they are, you drop them into your PWM register and over time, as you see, these PWM values will generate sinusoidal voltages to control the currents to be sinusoidal and perfectly in phase with the rotor flux. OK? And that's it.
So we've done this now. Step one, step two, step three, step four. And you can see we can summarize the whole thing here. Let me just go through very, very quickly. We sample our currents in the stationary reference frame. We generate phase C from the negative addition of phase A and phase B. And then I'm going to lump all the transforms together to do the forward Clarke-Park transforms. What we end up with on the output is a vector representation of those three current waveforms, which is a component that is directly aligned with the rotor flux and a component that's quadrature to the rotor flux. I now go through and regulate those independently with separate PI controllers to generate two correction voltages, Vd and Vq. But in order to apply those to the motor, I need to go back through and reverse the Park and Clarke transforms so that I generate three phase stationary frame voltages. And those are what actually get applied to the motor windings. That's the whole process.
Now to do that, let's say on a-- let's take a 2803x part running at 60 megahertz. How long does it take to do all this stuff right here? Typically about 15 microseconds. I mean, that's how fast we can whip through it. So the field-oriented control part of it is not really hard, especially if you know the rotor angle. If you don't know the rotor angle and you have to calculate it sensorlessly, then your equations can start blowing up. And we'll get into that later this afternoon. Yes?
That-- OK. The question is how much resolution do you expect to have on the rotor angle? That is somewhat application dependent. Like, in a very precise servo application you're going to need more than if you're just trying to do velocity control, for example. I would say to do adequate field-oriented control in most cases-- and again, I'm shooting from the hip here. This is just kind of rule of thumb. If you can be anywhere from 3 to 5 degrees of angle error, that's usually good enough. OK? Which means Hall effect sensors like BLDC is not going to work. You only get what, 60 degrees there? So that's not going to work. You need something that'll give you a little bit better than that. And also keep in mind that that's accuracy, OK? 3 to 5 degrees of angle accuracy. Much more than that, you start putting more of your current on the d axis and you start affecting efficiency.
We haven't talked about resolution though. If you have something that's only got that kind of resolution, then your system's going to be very jerky. OK? And that is something where you typically-- why you typically see encoders have at least, you know, 1,000 counts per revolution or something like that, to give you smoother current waveforms. Because that will affect how smooth your current is. Does that make sense?
Yes. That's something that most people forget about. Your PWM resolution can also have a problem with that. We do have an enhancement to our PWM module called the High Res mode, where-- I'm trying to remember. I'll get one of our hardware guy to answer that. Do you-- what is the resolution? It's like 60--
--150 picoseconds of resolution, which is pretty smooth. So you would never see that in a field-oriented system. Most the time where we'd need that kind of resolution is when you're doing digital control, like current-- powers-- digital power control applications, where your PWM frequency is maybe 200 or 300 kilohertz. Then you need that kind of resolution. But in most cases we've got enough iron in most motors that we can PWM at 20 kilohertz. And we'll find a resolution of just a 12-bit number or whatever, 16-bit number, is good enough. So-- yes?
The timing between the three samples. Do they need to be captured pretty simultaneously, or you have a little forgiveness between them?
Have you done this before? The question was when you're capturing the current waveforms, do you have to be sensitive to when you capture them? I mean, do you have to capture them at the same time or can they be captured at different times? Again, that's a subjective answer. Ideally we would like for them to be captured at the same time. OK? So it's like that's why in most cases we least have dual mode A to D converters. For example, if you want to capture your current, you need to capture current A and B as close to the same time as you can. So we'll have different sample and hold modules. Because if you don't, what happens is, like, you get a motion artifact. It's like a picture when you're trying to take a high speed picture. If the thing is moving really fast compared to your shutter speed, you're going to get blurring. Same thing with a high speed motor. If those current waveforms are really whipping and you take sample A current and then you take sample B current, they're different in time, so you're going to get a motion artifact on phase C calculation.
And then the question becomes-- I'll extrapolate on your question to ask the other question. And that is well, what if you're sampling voltage waveforms and current waveforms? Well again, all of them ideally would like to be captured at the same time. But at least that part of it is a little bit more forgiving. If you don't sample the voltages at exactly the same time that you sample the currents, it's a little bit easier to deal with. But you want to get those current samples as close at the same time as you possibly can to prevent motion artifacts. OK? That is a great question. There's probably a ton of other great questions too that are out there that you're thinking. OK.
It seems like there's a lot of trigonometric math here. If I was controlling, like, a lot of different motors and my processor was really loaded down, is there a way that the C2000 device, I can speed up those trigonometric operations?
So the question is, let's say that you've got a lot of motors that you're trying to control, or maybe you're getting bogged down with some of the trigonometric-- all the trigonometric calculations that need to be done. Is there a way to simplify the trigonometric calculations?
Like a new device?
Well-- like something that maybe would do trigonometric calculations for you, huh?
In hardware. Well, yeah. In fact, obviously when you get into multiple-axis control, that does present more of a taxing problem. Because now when you've done all the calculations for one motor, you've got to go through and do all over again for the other motor. You can't reuse part of the calculations from one to the other, because the currents are different, the angles are different, everything else. The best you can do is first of all, reuse the same routines, OK? So you don't have to have different versions of the Clare-Park transforms. You just call them from one library. If you've got a coprocessor, that can help with some of that stuff. Maybe you could have the coprocessor do it for one motor, the main processor do it for another motor. That would be another way to do it. How many times you will see that in the real world? I would say 90-plus percent of them are single-axis applications, though.
So-- and I've also heard people tell me that the coprocessors are nice as long as they don't have to program them. They say just give me one core that does it really fast, so I don't have to have multiple versions of code running on different compiler architectures to create to merge together. They say, just-- it's a problem. So, at least for motor control applications, they'd rather just all do it on one core and have that core be, you know, a 1 gigahertz clock. So.
Any other questions, though?
Yeah. If you don't have the rotor position sensor, how long does it take to [INAUDIBLE] to get assuredness [INAUDIBLE] after startup?
OK. Right. Right. So you're assuming you don't have a rotor sensor, then. OK. So the question is, if we don't have a rotor sensor, how long does it take us after startup to start using the field-oriented algorithm? And that is-- that's why a lot of the startup algorithms don't even use field-oriented control. They actually use a manual vector-oriented, just like the starter motor in your car, right. To get it started-- in order for the combustion to work, the motor already needs to be running. So you've got a chicken and an egg thing here. Well, how do you get the whole process started? Well, you come in with something else called a starter motor. You get the whole thing working. And then once it gets working you can turn the starter motor off.
Same way with field-oriented control. You need to get the motor spinning. And you spin that manually just by applying a rotating vector out there on the motor. Keep in mind, that's going to be a very, very poor efficient operation, because the rotors just going to naturally want to align up with your rotating current vector, which means most the current's going to be on the d axis. But that's OK, because you just want to get it moving. Once it gets moving, you're running your angle observer concurrently. And once you see that, OK, it's converging, then you say it's started. We can now convert over to the field-oriented routine and turn off the starter algorithm. Does that make sense? And how long it takes, it depends on how long it takes to get up to speed before you start getting good angle information.
Yeah. Yeah. All that kind of stuff. That's exactly right. These are great questions. Let's-- I want to make sure you ask questions on this, because this is important. Yes?
[INAUDIBLE] is going to be 0. So when evaluating the desired flux, you'd put sort of a 0 input, right? Is that--
Ah, OK. The question is, he's calling to my attention the fact that I said that I wanted it the d axis current to be 0, because I don't want my current vector to be aligned with the d axis at all. But in this diagram right here, I show that the d axis value is the desired flux. So what gives? Is that kind of-- right.
Well, it turns out that for other motor topologies, and in particular the AC induction motor, I need to control the flux in the machine. In fact, I need to generate flux in the machine, because I don't have a permanent magnet. So for a permanent magnet machine, a PMSM-- permanent magnet synchronous motor-- I've got a rotor that's got permanent magnets on it, obviously. I've got all the flux I need. I don't need any more flux, so I set that to 0. For an AC induction machine, I have no flux, because I have no permanent magnet. Any flux that I want to exist in my AC induction motor, I've got to induce it from the stator. And this is the current that will induce that stator flux.
Yes. Well, actually, when you are-- the motor will have a rated flux. It'll say, OK, it wants to work at this flux. If it's 60 Hertz or 50 Hertz or whatever it is for the voltage that it's rated at, you can say OK, this is volts per Hertz. It's like 430 volts at 60 Hertz. That's rated flux. That's another dimension for flux, is volts Hertz, if you go through and work it out. So I know what that will be, then, and I can set that motor to work at that rated flux.
Now, even for permanent magnet machines, we're going to see that there are times when I do want to start playing around with the flux, and that's where I do it. And we'll see that we need to do that for high speed operation. It turns out that the motor flux gets in our way and we have to reduce it. So I start putting more current here to buck the magnets in the rotor to allow me to do higher speed operation. OK? Other questions?
Think you finally got a-- think you understand this? Think you understand how it works? It's nothing more than a bag of tricks to do some vector transformations to jump from one frame of reference to another frame of reference, do the regulators there, and then jump back again. That's really all we're talking about. Well, let's see if you really do you understand it.
So now we're going to do a lab exercise. And this is always a fun one. I refer to this as my LEGO lab, because what I've done is I've created this lab where all the pieces to do field-oriented control, all these modules, exist in a simulation environment. And what you've got to do is to take all these little modules and hook them up together to make a complete field-oriented system, so hopefully you were able to download the VisSim simulation program and run the little example file I got to make sure that's working. So hopefully that's the case.
And what I'm going to do now is just to kind of get you familiar with the VisSim environment. It's a very, very powerful simulation environment which, by the way, also does code generation targeted at either your platform host or even to an embedded platform like one of our C2000 processors. Once you get your control algorithm simulated the way you like it, you can just click on it, say Generate Code, and it'll actually create C source code that you can dump right into your machine to run that algorithm. So it's actually a very powerful tool. We're not going to use any of the code generation stuff today. But we do want to use some of the simulation capabilities.
So what I'm going to do is to ask that you follow along with me as we go through this process. Let get out of here. And go into the folder called Lab Exercises. And in there you should find a file which is called 03 FOC Speed Control. Go ahead and open that up. Now when you do, you should see something that looks like this. So we're going to go through and do this together. And then what we're going to do at the very end is you're going to run your simulation. And if you did everything correctly, you're going to get the wave forms that are shown right over here. This shows the speed and the current plots of a motor that's accelerating up to speed, and then finally when it gets to the desired speed it levels off. And these are the current waveforms in the stationary reference frame.
OK. So in your mind, let's go back and let's replay the scenario, step one, two, three, and four. What was the first thing we had to do?
Measure the currents that are flowing in our motor. So in order to do that, I'm going to need some A to D converters. So grab your A to D converter right here, and just drag it down here into the workspace, because we're going to create a long block diagram of all these things strung together. So just take your A to D converter. Click on it. Click and drag, and put it down at the bottom there. And if you open up any of these blocks, you can actually see what's inside. This is a-- I've got two simultaneously sampled 12-bit A to D converters. And then I take those samples, I add them together and take the negative, and that generates my third current sample, as shown right here.
Now I've got my three current samples. What's the next thing I want to do? Do you remember?
Not yet. We're not up on the rotating reference frame yet. I've got my three currents.
Yes. Yes. So I'm going to take my forward Clarke transform, and I'm going to run it down here and just position it, kind of park it on the output-- near the output-- of my A to D converter. Now I need to connect these two modules together. Now, the way you do a connection in VisSim is you take your cursor and you position it over the output of the first module that has the output, click and hold-- left click and hold-- and then drag a wire over to the corresponding input on the other side and then release. And that will leave a little wire that's connected between those two. Do the same thing for phase B and also for phase C. And now we've connected those up to the forward Clarke transform.
What's the next thing we want to do? After we've done the Clarke transformation, we want to do the Park transformation, right? All right. So let's take the-- where is it-- the forward Park transform and drag him over here. Now, take the alpha output of one and connect it to the alpha input, and the same thing for the beta output and input. Now, you remember in order to do the Park transform we need to know rotor angle. We don't know that yet. So we're just going to leave that blank for now, and we'll come back and fill that in later as soon as we get our motor plopped down on this diagram.
OK. So now that I've transferred my current into d and q, what do I need to have-- or what's the next thing that I do with those currents? They're now up on the rotating reference frame.
Now I generate the error signals, right? Now I'm going to go and put them into my regulators. So let's go find some current regulators. I've got two of them here. And in this case, as the question was asked earlier, this is a permanent magnet synchronous motor. So both of those PI regulators are exactly the same. Doesn't matter which one I use. I'm going to create one for the d axis. And I'm going to create another one for the q axis. Make sure you don't grab the speed regulator though. We're just talking about the current regulators, which I've already tuned ahead of time and everything else to work with this example.
Now I take the d axis output and I put that into the feedback. This is the feedback current that I'm measuring here. I put that into the feedback of one current regulator. And I take the current-- the q output of the Park transform and put it into the feedback of the other current regulator.
Now for the d axis, assuming we don't want to do any field weakening or anything strange, what do I want to set the reference value for d axis current to be?
0. So let's go up here to the Tool Palette, and there's a little 1 with a square around it. That's my Constant tool. I'm just going to click on that, and then I'm going to drag it right down here and put it in front of the reference for the d axis current. Now, that's-- right now it says I want 1 amp. I don't want 1 amp. So you're going to double click on that, and you can set it to be whatever value you want, in this case 0. OK? And then run that into the reference input for the d axis current regulator. Everybody with me, or am I going too fast? OK. Yes?
The what block?
Oh, the simultaneous sampled A to Ds?
It should be up in that grouping.
It's red because he went into the module and came back--
If you [INAUDIBLE]. Like, if he does a right click it'll go back.
Yeah, yeah, yeah. Sorry about that. So let's see. Just-- yeah, there we go. There we go. Sorry.
OK. Now for the q axis regulator, what is our reference current? What should that be? That's the torque that we want. What is the torque that we want in a speed loop, in a cascaded speed loop?
It's the output of the speed regulator. So let's go now and get the speed regulator. PI speed regulator. It's only got one output. So I'm going to drag that down there, and I'll hook that into the reference for the q axis, as shown here.
Now, you notice that the PI regulators also have execute pins on them. That's because this is a sampled system. If you open up these blocks, you'll see that they have digital Z terms in there which actually sample. But we need to know when to sample. That execute pin is going to come from the PWM module. In fact, that is where we typically generate the execute for a lot of this stuff is we synchronize the whole field-oriented process to the PWM waveforms. We want to do these at a certain time in the PWM waveform, because that's where we capture the value to be just right. In other words, the current waveform, if it's under PWM control, remember it's rippling, right? It's got ripple on it. If I capture right in the center of that ripple, that's where I get the average value of the current. So we need to-- when we put the PWM module down, we're going to create an execute signal which then we're going to feed back to all these other blocks to say OK, run now. All right. So we'll leave that blank for now.
We've got our PI current regulators for the d and q axis. They are generating correction voltages Vd and Vq. Once we have those, what do we want to do with those?
Park. All right. Let's go grab the reverse Park. And we'll feed that into-- so the top one, we'll just connect its output right into d. And the bottom one we'll put its output into q. And once again, we need angle information which we don't have yet. So that's-- we'll wait for that.
Now we're back in the stationary reference frame with V alpha and V beta. Before we can apply it to the motor, what do we need to do with those?
Reverse Clarke. All right. Again, the pins are labeled. So just hook up between the like names between the different modules.
OK. So now I have Vu, Vv, and Vw. What do I want to do with those? Voltage A, B, and C. I said put them on the motor, right? Well, OK. But those only exist as 0 to 1 signals so far. I want to run them first through to a PWM module. So I'm going to take those values and drop them into my PWM module. So go over here and find the center aligned PWM module.
By the way, the color coding in this diagram. All of the cyan colored modules are peripherals or hardware peripherals, usually on the chip itself. The green blocks are, like, analog simulations of the motor itself or the load. Anything that's hardware analog is green. And so what we'll do-- and yellow is all the code that's running. Those are all software routines.
OK. So now I take my center aligned PWM module, and I take the voltages from u, v, and w and put them into my center aligned PWM module. Now that I've got center aligned PWMs coming out of this thing, what do I hook those up to?
The inverter. I now need to drive the motor with something. So I've got to have a power inverter, and that's the green bottom block. All right. So connect those up together.
And you'll also notice on the output of the center aligned PWM module I have this pin called Sample. This is the signal that I want to route back to all those other software algorithms and say when you get this trigger pulse right here, that's when I want you to execute. So how do I wrap those around? Well, you could just click on the sample output and click and drag back to any one of those other blocks. And if you do that enough times, you're going to have a big mess here. It'll look like a wire-- a net-- a hairball of wires running everywhere. I prefer to do it with assigning variables.
So go up to the toolbar, and you're going to see this block right here. It's a red block called VAR. It's got a red VAR on it. It's kind of right next to that symbol that kind of looks like a diode. But it's called VAR. Click on that and put that on the output of-- or close to the output of the Sample pin. And it should drop a little block that says variable in it. Let's double click on that. And let's call it something like, creative, like, Sample. So you double click on that. Change the name to Sample. Hit Return.
Now when I drag the output pin Sample on the center aligned PWM module over to the input of the variable, I have now created a variable which has that signal name on it. I can now go back to all these things that had the Execute pin on them and I can basically-- what I want to do is click near the Sample variable, click and drag so that I select it. All right. And with it selected it's going to turn black. I now go Control-C, Control-V. And that creates another instantiation of that, which I can now put that anywhere I want. So I'm going to put it on the input of the PI current regulator. I'm going to do another Control-V, put it on the other PI regulator. Where else did I need it? Oh, the speed loop. Control-V. OK. Once I've done that, then connect from the output of the sample signal into the inputs of those Execute pins, as I've done here. So now those software routines know when to run, which is synchronized to the PWM module.
All right. The inverter now is generating amplified PWM voltages that are now ready to be put on my motor windings. And in this case, it's just the little Anaheim Automation motor. This is one that comes in our kits, and I've created a model for that. So now I'm going to connect up my inverter to my motor with those three wires.
OK. Now, the output of the motor is going to have three variables. One is torque. One is phase U current and one is phase V current. This is the same as phase A or phase B current, if you want to think of it that way. So I'm going to once again go up to the variable block and I'm going to say drag down a variable block right near the output of the Iu pin on the motor model and then double click that. And I'm going to call that, I don't know, A-- let's call it A Current. And then I'll connect that together. And I'll do it again. Variable-- click the Variable. Create another variable. Double click on that and call that B Current. Whatever you choose to call it. It's-- you can do whatever you want.
Now, I'm going to take those two currents. I'm going to click and drag over both of them to select both of those, hit Control-C, Control-V. And where you think these are going to go?
That's right. They're going to go back on the inputs of our ADC for Iu in and Iv in. I shouldn't have labelled it that, because that could be confusing. Just remember if you did the same labeling that I did, A current goes into Iu, B current goes into Iv.
And oh by the way, I see that there's a sample input on the A to D that I forgot. So click and drag on a nearby Sample variable, Control-Copy, Control-Paste. And then put that on the input of the A to D sample. Did you catch that? We had one more sample pin that we needed to fill in coming into the input of the A to D.
OK. We're getting close. Now the torque output from the motor is going to go to our load now. Let's say we have a big flywheel or something out there that the motor is actually applying torque to. So we're going to grab our load block, which is the green one, run it out here, take the torque output of the motor and connect it to the torque input of the load.
Now the load has two outputs. One is shaft speed and one is shaft position. The position, I'm actually going to run it through an encoder simulation first before I feed it back into my algorithm. So grab the last remaining block, which is the encoder block, and take the shaft-- wait a minute-- shaft position and put that down into the shaft position input on the encoder. You can also see that the decoder signal needs to be sampled. So we're going to find one of those sample signals again, select it, Control-C and Control-V, and paste that on the input of the encoder module.
All right. Now we're almost ready to close the loops. Take the angle output of the encoder module, go up to the VAR tool again, and drag down a variable for the output of that. And we're going to change that to be-- instead of variable, we're going to call it Angle-- and then connect that to the output block of the encoder.
Now where does this angle information need to go? Do you remember? What transform needs angle information in order to work properly? The Park transform. Actually, the forward and reverse Park transforms both need it. So I'm going to select Angle, Control-C and Control-V, and go back and find one of those Park transforms. Here it is. Here's the reverse one. I'm going to run the Angle into the angle input on the reverse Park transform. And then one more Control-V for another instantiation of it which goes into the angle input on the forward Park transform.
All right. Now we're getting close. One more thing that needs to be done. And that is the output shaft speed in terms of RPM, I'm going to go up to the VAR tool, create another variable, put it on the output of the load block right next to the shaft speed. I'm going to call that variable something creative, like Speed, and then connect it up to the load block.
OK. Where does that speed feedback need to go? The speed regulator. So I'm going to-- once I have that created, I'm going to select it and do a Control-C, Control-V, and run that back over to my speed regulator, put it into the feedback.
Now the only thing we don't have yet is the reference speed that we want it to go to. And if you look up at the top, I have a bunch of global variables defined up in the top left hand corner of the simulation page. You can see where I've already taken the liberty of defining the PWM frequency, the PWM period, the bus voltage. My current limit I've set to 20 amps. A to D resolution. There's also something there called Speed Reference, which you can see I'm setting to 2,000 RPM. So just click over-- click and drag over that Speed Reference variable, Control-C and Control-V, and then run that down to be the input of our reference there.
OK. At this point, I think everything is connected up. If we are unsure, let's make sure we go through and just scan through the whole block. There should be no unconnected pins. Everything should be connected. And on my diagram, it looks like it is.
OK. Is everybody at this spot? No?
Just give it a few seconds for us to catch up.
OK. Sure. Yes?
Sample. Or whatever you named it.
How do you get it? Oh, OK. Let's go over here to the output of our PWM module. See right here? There's an output on the PWM module called Sample. And you create a variable there, then copy it over there. In fact, Sample has to go everywhere. Sample is used to sample the encoder signal, the currents, the A to Ds, it just-- and it also tells the algorithms when to run. So that's a very critical piece to this whole thing. Any other questions?
I didn't tell you this, but you could have avoided all this just by opening file 3A instead of file 3, where everything's already connected up for you.
The reference right here into the-- oh, this is my d axis current. I want 0. Yeah. I don't want any current in my d axis. Maybe I was going just a little bit too fast here.
Oh, OK. Yeah, yeah. There is right-- well, at least in my case it's right under the Tools part of the toolbar. There's a little block which has a red 1 in it. Maybe it's-- depending on your screen resolution it might be somewhere else. But on the toolbar there's a red-- there's a block that has a red 1. You click on that, drop it into your simulation, and then double click on the 1 to change it to a 0. Now, you could have done it the way that you suggested. You could have created a variable called 0 and then assigned 0 to it and then used that every-- I mean, it would work too. It doesn't matter.
How many are still working? Let me see your hands. Everybody's done? OK. How many are done? Let me see your hands. OK. Most of us. So for those of you who aren't done yet, you can still keep working on it or catch up. But those of us who are done, here comes the real test. I want you go to the toolbar, and you're going to see this little green Play arrow. Push that and it's going to run your simulation. And if you did everything correctly, the waveforms that you get in the left two graphs should be exactly equal to the wave forms you get that I've shown in the right graphs. So I'll push it. Yay.
Uh oh. Probably several people made some mistakes. And in most cases, you can go back and it's just because either there's an unused connection somewhere or one of your connection variables is misspelled or not the same that you dragged over somewhere else.
So just-- I guess the first thing, go through and make sure everything's connected up. Go through and kind of scan and make sure everything's connected up the right way.
Sure. Make sure the angles are included for the Park transforms, both forward and reverse.
OK. Why is it such a nice linear ramp?
[INAUDIBLE] Well, it seemed like, yeah, you'd have a reference behind your, well, right now. [INAUDIBLE]
OK. The ramp-- so the question is where does the ramping come from? I'm putting in a commanded speed of 2,000 RPM. So it starts off immediately at 0 RPM. So the speed loop says give me tons of current to make it go.
Right. But on the output of my speed regulator, if you're going to open that up, you'll see it's clamped at plus or minus, I think, 20 amps or something. So it can never request more than 20 amps out of the q axis. So what happens is you'll see that the current waveform is flat topped at 20 amps, which means that it's generating a constant torque. A constant torque applied to an--
--a J, a constant moment of inertia will equal constant acceleration. Yeah.
Oh, you want to zoom in, like on-- where do you want to zoom in?
At the top of the ramp. First thing you can do is double click in the header part of that.
If you want to zoom in, hit the Control key, hold it down, and then click and drag over an area that you would like to zoom. Then let up with the mouse, and bang.
Right. It's constant torque. But then finally as it starts getting close enough, the speed regulator says back off. I'm actually using dynamic integrator clamping here so that it doesn't overshoot. So it starts backing off. It brings the current level down then to bring it into a nice smooth 2,000 RPM.
Yeah. They don't have, like, the labels. They have the block things, but not the labels for these.
Oh. Yeah, yeah, yeah. So let's go into View. Hit Block Labels. OK. Go back and connect your labels. Yeah. Now unclick the other ones. Block Labels. Well, let's see. Go back into it. What else do we have here? Try--
Presentation Mode? That's what I've got checked.
Maybe that'll turn it black.
No, there we go.
Well, that's what I've got on mine.
Yeah. So apparently--
So I don't have-- he has diagrams.
The other thing is he doesn't have the Diagrams entry over here, which is weird.
Oh. Well, I think that's just because in the normal install, probably it doesn't come with that. Did you do the normal install?
I did a fresh install following all the instructions that--
And we checked. And, you know, he's got the same version and everything.
That's really bizarre. And also it looks like these were white instead of--
Yeah, that's what I was--
Well, that is kind of weird. Well, it should still work, I think.
OK. yeah, I got behind because I didn't do this ahead of time like I was supposed to, and so--
So I was--
Yeah. I'm hoping-- try opening one of these just to see what it looks like inside. Yeah, I mean, it's all still there. So hopefully it should still work.
I don't know why it's all a different color, though. That's kind of bizarre.
OK. So for those of you who are finished and your stomach is growling, you can go ahead and we've got the lunch already delivered back there. So you can get going on that. But I'm going to continue to just kind of move around a little bit. And if you have any questions or concerns, we can try to get your simulation running.
Oh, to zoom out? Control right click. Control right click and it zooms out. Yeah.
Now once you've got the simulation working, then it can become really fun. Like, you can try all kinds of different things. Change the PWM frequency. Change your A to D resolution. See what happens to all these things. Yes?
I've been over our connections several times, but my results are not happy.
Oh, my goodness. All right, let's take a look here. Let's start off at the very beginning, and--
Scroll me through the very beginning of your--
All right. So let's go back over to Sample, A Current, B Current. OK. And got the transform angle theta. Right. OK. And feedback, feedback. Sample, execute signal. OK. [INAUDIBLE] Speed feedback, come over here. It's OK. This is forward. Reverse Park transform, alpha, beta. [INAUDIBLE] OK. So just scroll over a little bit farther now. [INAUDIBLE] Vw, torque. Now, you don't have underscores in this, do you?
OK. You don't have underscores in the other one either?
No, no. They were copied and pasted.
Copied and pasted. I mean, it doesn't matter if you have underscores, as long as you have the same as what the other one is. Motor torque, load, speed, shaft position degrees, Sample, angle. Well, I'll be. I don't see anything wrong with it.
Yeah, I've been over it a couple of times, and I can't find a missed connection or anything.
All right. So scroll back over.
How do you zoom out?
Oh, there's a-- these little bars right here are zoom in and zoom out. So you can actually just zoom-- or if you mean, like, go inside a block?
No, I meant just make sure there's nothing hidden down here.
Oh, yeah, yeah, yeah. OK. So go back over-- scroll back over. Just scroll up to the top. I want to see if there's anything left up there or--
That's the input to apply.
Can you scroll over a little bit farther? I want to just make sure I get the--
Now initially, I-- rather than copy this variable and take it down, I drug the whole thing down.
Let's just make sure everything is working OK. Why don't you minimize this up here.
And bring up 3A?
3A. Let's bring up 3A and just see what happens. OK. All right. Yeah, run that and see what happens. Well, I'll be. That is bizarre. I can't imagine what I'm missing. You didn't go inside of any the blocks, did you?
All right. Well, I'll try it again offline.
Let's go back into the other one. So go back into the other diagram. This kind of irritates me, because it's gotta be something just simple, and I just don't know what it is. Right over here. There you go. Let's go back and look at some of the connections [INAUDIBLE]. Oh, I see it right now. Sample's not connected up there.
It sure isn't. I was wondering if that might have been it.
That's it. There you go. Now try it.
Yay. All right.
So where is the current [INAUDIBLE]? Where is that?
It's on the output.
2015年 3月 13日
Motor topologies have remained relatively unchanged over the past century. Control techniques by comparison have experienced explosive growth, driven at large by technological advancements in the semiconductor industry. This seminar focuses on advancements in the control of motors with an emphasis on field-oriented principles with brushless AC motors. This video is part 2 of a 5-part series and covers Field-Oriented Control of Permanent Magnet Synchronous Motors.