VFD, FOC, DTC - back to the basics - DIY Electric Car Forums

# DIY Electric Car Forums> EV Conversions and Builds> Controllers

 User Name Remember Me? Password
 NuWiki Register Blogs FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
#1
08-01-2012, 01:29 AM
 Siwastaja Senior Member Join Date: Jul 2012 Location: Finland Posts: 571
VFD, FOC, DTC - back to the basics

Hi everyone, my first post. I hope we have some VFD experts here. I am just having difficult time understanding some VERY BASICS of VFD drive algorithms and it bugs me a lot .

Actually, we have started doing an EV conversion at an electronics club at a local university of technology here. As we have deep level knowledge on electronics etc., we will create all the electronics by ourselves. For example, we are prototyping a simple active BMS based on bi-directional flyback transformer design on every cell module. Currently we are rewinding an industrial 13 kW(cont) 2-pole induction motor for lower voltage and 4-pole configuration; maybe we can get 20-25 kW(cont) out of it.

Let me also state that I'm a very practical or reality-oriented guy; I want to see the waveforms instead of mathematical formulas, I want to see reasons for technical decisions instead of the typical "this is just how it is done". I believe that the implementation details come quite naturally after you have nailed down what exactly to do and why; and what happens if done otherwise.

Anyway, we know the very basics of VFD's, and we already built a very simple working prototype using an FPGA for control and IGBTs for power stage. Just stored a sine wave table in FPGA's embedded memory and created the PWM on the fly. Just a dozen lines of VHDL. Then 6 optoisolated IGBT gate driver IC's and the IGBT's. Very simple. But now we need to create the "real thing" that's suitable for a car, thus, controls torque, not speed.

But, to be fair, information available on VFD's is driving me mad. I have spent days and days reading on VFD's but can't find any real information from any practical viewpoint, just mathematical jibberish; obfuscating what REALLY happens and WHY it needs to happen behind fancy names, terms, transformations and formulas.

What I mean, getting the motor spinning with variable speed was just a work of two hours or so. And it nicely did Regenerative Braking when I change the driver frequency to lower than the actual motor speed. This is very basic stuff.

Also, the curve of slip vs. torque is very basic stuff. Everyone has seen it; at zero slip, there is zero torque. Then the torque goes up with slip, until it hits a point of maximum torque. Then, if the slip is further increased, the torque starts reducing and this operating region ("stalling") is to be avoided. The curve can be mirrored for "negative slip" for Regenerative Braking. (So the VFDs start the motors at full torque by ramping up the frequency from zero to avoid the "stalling" region. At the same time, "lower voltage", or to be more exact, lower duty cycle, is used to limit the value the current in the windings will rise to due to their inductance. Simple electronics. Am I right?)

So, it appears to me that if we want to control TORQUE as is the case in EV's, we want to control SLIP. And slip is super-duper-hyper-cyber easy to control. Just add a speed sensor (encoder) to the motor shaft and adjust the drive frequency accordingly with a PI loop. Hence, the gas pedal could actually be a "slip pedal". When pressed fully down, we adjust the output frequency to the measured rpm plus "slip that gives maximum torque". When the pedal is fully released, we create output frequency that matches the real measured rpm to create zero torque; or even a bit lower frequency to apply a bit of Regenerative Braking.

This is called a "closed-loop (= feedback) V/f control", and it is almost unheard of.

But, apparently this cannot work well, because everyone and every reading material tells us that we need to use things that involve something like vectors from outer space and transformations named after some dead people who liked math . There is enough material to get by "how", but no one tells us "why".

Closed-loop V/f control is practically undiscussed. More sophisticated controls such as FOC and DTC are always compared against open-loop V/f which, naturally, cannot be very usable in EV.

Now, I admit that most probably everyone is right and we need to use FOC or DTC (and my experience in FPGA's allows us to do practically anything, no matter how computationally intensive, but that's not the point), but it would be nice to hear even just one argument for this, because: why do something complex if you don't understand why you do it? I have tried to catch the BASIC IDEA behind FOC and DTC, and now I'm coming to the very basic question here;

I get the idea that compared to closed-loop V/f, FOC and DTC allow controlling of different components of phase current, namely torque-generating current and flux-creating current, separately. Firstly, did I get it right? Secondly, why is this needed? If I just control slip in a closed-loop V/f control by creating sine-wave approximation by using PWM with constant phase offset of 120 and 240 degrees, and control frequency and voltage (or more correctly, a multiplier for PWM on-cycle length), what do I miss? Does the system waste energy in wrong type of two currents?

We all know that ACIMs run very well off 50 or 60 Hz 3-phase supply, except for the starting where the motor is running some time on the unwanted region below the optimum slip point. But is it true that they run well only with the rated torque reading giving the rated power? Does their efficiency fall behind if there is higher load and higher slip, even if it is still on the better side of the curve?

I would highly appreciate any pointers to practical reading material, or any open VFD designs. And, of course, publishing our results, schematics, code etc. goes without saying.

Thank you for your time and for the nice forum full of information. I hope I can contribute something back in the future.

Last edited by Siwastaja; 08-01-2012 at 07:45 PM.

#2
08-01-2012, 09:04 PM
 stickytechnology Member Join Date: Sep 2010 Posts: 74
Re: VFD, FOC, DTC - back to the basics

Hi,

I've often wondered exactly this myself. I haven't tried what you are describing, so I don't have any empirical data to back up what I am about to say, so I hope that you do try it and share with us the result.

My best guess as to why FOC and DTC are preferred over closed loop V/Hz is because the torque vs. slip curve you often see published is a steady state approximation. Induction motors have a time constant to them that determines how fast they can build up rotor current and thus torque in response to slip. DTC and FOC are then built to optimize control as mich as possible-- you get the torque you want as soon as possible after asking for it. With automotive applications, though, it seems like people are used to a little lag when they ask for torque- it's often almost a second between pressing the pedal and getting full torque. In fact, I think some DC controllers have to slow down the control loop to avoid broken drivetrains and so on.

So, as long as your closed loop control is slow enough, I don't see why what you're proposing won't work, but like I've said before, that's an armchair opinion. I'm still hoping to get a DTC system working because the elegance is appealing, but I think Stiive will beat me to it
#3
08-01-2012, 09:17 PM
 adeyo Senior Member Join Date: Jun 2012 Location: Lynchburg, Virginia Posts: 182

What they said

#4
08-01-2012, 10:45 PM
 Stiive Senior Member Join Date: Nov 2008 Location: Australia Posts: 404
Re: VFD, FOC, DTC - back to the basics

I'm in the same boat as sticky here as i haven't finished my controller, and so I will base my answer purely on the theory.

The main and biggest advantage with vector control is the ability to control the current producing vectors independently. This allows you to effectively decouple the torque and flux of the machine.
Fluxing an induction motor quickly takes a lot of current, therefore at stall a vector controller will flux the motor while producing 0 torque. This means when a torque command is received, all the current available can be used to produce shaft torque and therefore you can get full torque from 0 RPM.
Another advantage is applying advanced flux maps to make the motor run more efficiently or provide more performance (such as MTPA -maximum torque per ampere). Again, this can be controlled independently of the torque.

Apart from the advantages, yes you can control torque from slip, and yes your right the simplified equivalent circuit model of induction motor is piss to understand. But if your chasing efficiency, which is a big deal in a large motor/controller combo running from a finite energy source (batteries), then you need to work out the most efficient way to delivering that torque. If you want to stay away from out of space vectors and dead-guy transforms, then you will need to use an equivalent motor mathematical model which requires ALL the motor parameters AND speed feedback. But still you can only control voltage/current and frequency to effect your slip/flux/PF in unison (still no decoupled control).

Another problem arises with how much torque are you actually producing? Increasing the slip doesn't always produce an increase in torque, and any increase in torque isn't going to be linear and is dependent on a whole range of factors. Again you could use your complex mathematical motor model to determine torque from voltage/current/slip/flux/PF.

So in the end, to get a decent system going, you need voltage sensors, current sensors, speed feedback and complex mathematical algorithms - and STILL it is an inferior control system.... The complete control will be highly sensitive to motor parameters and hence heating of the windings/ambient temp/age etc.

If you want to understand vector control, sure you need to be pretty good with maths, and the devil IS in the detail (somewhere). How they work is explained in the maths, and there's no getting around that, and its obviously based on how the motor really works and lots of advanced theory - it takes a lot of reading to get your head around.
However, if you want to simply just implement vector control, there are plenty of application notes (from microchip for example), that have all the code there ready for you ready to load.

End result of vector control is you get much better/advanced control of the motor, must better transient response time, better efficiency, less parameter sensitivity, and the code ends up being a lot smaller. THEN you can even start implementing advanced features such as sensorless, parameterless etc, the fun never stops!

All that being said though, I think you can still have a decent advanced V/hz slip control. PSTechPaul has some good idea's for this aswel. I just think, if its starting to get too advanced, why not move to vector control and be done with it

Hope this helps

Last edited by Stiive; 08-01-2012 at 10:52 PM. Reason: Added disclaimer :)
#5
08-02-2012, 08:56 PM
 Siwastaja Senior Member Join Date: Jul 2012 Location: Finland Posts: 571
Re: VFD, FOC, DTC - back to the basics

Thanks for your opinions so far; it has been helpful. And Stiive, I've been reading about your controller project. Nice work, keep going!

But theoretically, this is a somewhat funny case. Due to my work, I read many academic papers and have written some to be published in scientific journals. And the very typical abstract goes like this:

"Traditionally, A is done like this. However, it poses a problem of B. Hence, we propose a new approach C that improves parameter X by Y%"

or for later work,

"Traditionally, A was done like this. Implementing it in way C solved problem B and increased parameter X by Y%, but posed a new problem D. Our proposal further increases parameter X by Z%"

It is funny how I just couldn't find any informal or formal arguments for FOC/DTC versus "traditional". Now at least I have your claims that it increases efficiency! This is a very good start and I'm not going to ask "by how much", because this is just software and implementing it only takes time, and in a hobby project, time is free. Any improvement in efficiency is very welcome in a battery-powered system.

Car as a load is an easy one; you usually do not need full torque at the start. Due to air drag increasing in the square of velocity, if you want a vehicle that can go highway speeds, you will have so much power (and torque) in the motor that starting up from zero is definitely not a problem (by other words; if you have ANY acceleration left between 100 km/h and 120 km/h, you will have enough acceleration at lower speeds).

However, as we will be having somewhat undersized motor, zero-speed torque might still be a consideration. And in any case, highest efficiency is a must.

It seems that there's no simple way out; the algorithms are complex to understand. DTC seems very elegant but I'm a little bit skeptical about high-speed, high-accuracy analog measurements in a noisy environment. It could be fun to try out with very high speed ADCs and an FPGA. Something like 100 MSamples/s and FPGA with a clock rate of 300-400 MHz. You really could go much below microsecond timing.

For FOC, I'm a bit worried about how much time and testing it will take to fine-tune the parameters. It's not a problem for a matched controller and motor, but when both controller and motor are DIY . . .

So, maybe I just need to implement both slip control and vector control and then compare them. But I think we need to start from the basics to get anything done. That's why slip control is a good starting point, and so much more usable than open-loop V/f with little more complexity.

What do you feel, are (correctly tuned) FOC and (correctly implemented) DTC comparable in resulting performance with each other?

Last edited by Siwastaja; 08-02-2012 at 09:00 PM.
#6
08-03-2012, 03:27 AM
 PStechPaul Senior Member Join Date: May 2012 Location: Cockeysville, MD 21030 Posts: 2,938
Re: VFD, FOC, DTC - back to the basics

I don't really understand DTC and FOC either, although I took a course with Microchip in 2005 and much of it seemed to make sense. But it did involve math which is not my strong point, and I just accepted their conclusions that this was a better approach. This was not specifically for vehicular motor control and I think that is where the DTC comes into play.

But I don't have much experience with VFDs. Around 2005 I rewound a small AC motor for three phase and more poles and lower voltage, and I got it to run quite nicely with a PIC18F2331 and six MOSFETs and a rectangular waveform. It ran directly on a 12V battery. But I did not take much care with current measurement and voltage spikes and I drove the MOSFETs directly from the PIC, so it eventually burned up while I was demonstrating it to the folks at a motor rewind shop. Here is an excerpt from sci.electronics.design which goes into my saga:
http://sci.tech-archive.net/Archive/.../msg01591.html

Now I have a commercial Fuji/GE 2HP VFD that I'm using on my tractor project, and it seems to work nicely, but I'm not at the point where I need DTC. But there are many settings for the controller and all sorts of delays and limits and torque boost and motor profiles. And there is also provision for implementing an external PID loop by reading the torque as computed by the drive and comparing that to a throttle position sensor and it should then be a trivial task to make the motor respond nicely to the demands of the operator.

I have my doubts about the increased efficiency of fancy control electronics and algorithms. A motor is really a rather simple device and because of its electrical inductance and the mass of the rotor and drive train components, I don't see how microsecond corrections of applied voltage will make any percievable difference to the motor and its performance. When the source of the control is the operator's foot and the feedback is his sensation of acceleration and the desire to control speed, that sets a rather low frequency limit for the PID loop.

Of course the motor must be driven with a PWM signal with enough resolution to adjust the torque and speed finely enough, and to avoid mechanical and audible noise. But these can be adjusted as well, and the specifications for my drive show efficiencies of 90-97%. The motor efficiency itself is usually not quite as good. I suppose it's important to try for a couple percent more efficiency, but I think that is more a function of how the vehicle is driven and other factors such as weight, speed, wind resistance, tires, road surface, etc.

I also don't understand the reason for measuring phase voltage by reading the bus voltage during the time that the voltage is being applied by the IGBTs. The voltage drop of the devices is considerable and variable depending on many factors, such as current and temperature, and also the motor leads contribute a lot of inductance and voltage drop, so if accuracy is important, I would think a separate set of leads connected directly at the motor would be much more accurate. And it is very easy and inexpensive to do with instrumentation amplifiers and properly compensated voltage dividers (like scope probes).

Also, it seems that it is popular to read the bus current and calculate the phase angle vectors mathematically based on rotor position, which requires an accurate encoder or some tricky "sensorless" measurements. I think it's better to read the current in each leg of the bridge to detect desaturation and overcurrent, using low side shunts, and direct reading of each motor lead using an isolated Hall effect current sensor.

But if you know the motor's characteristics you should be able to just read the average DC current of the bus, which should be proportional to torque. It is not even very important to know the actual torque very precisely, because the operator simply asks for more or less torque depending on driving needs. And the motor controller simply needs to apply a PWM voltage according to a sine table at a frequency which provides the speed needed to achieve the desired torque. There is probably a "sweet spot" where you get the maximum output just under breakdown torque, but I think this can be readily sensed, especially if you have a shaft speed sensor as a "reality check".

What I think might be worth investigating is recreating a relatively pure sine wave to apply to the motor, rather than the direct PWM drive. The motor has a lot of capacitance and inductance and the the fast waveform transitions create losses through the cables to the motor and also cause stress on insulation and probably core losses as well. I propose adding LC filters to the motor leads to clean up the signal by removing the high frequency harmonics. I simulated this very crudely, and have not tried it on an actual motor, but I think it holds promise to increase efficiency, reduce EMI emissions, and other benefits such as longer motor life.

#7
08-14-2012, 08:34 AM
 gunnarhs Senior Member Join Date: Apr 2012 Location: Iceland Posts: 271
Re: VFD, FOC, DTC - back to the basics

Hi,

I have been working on U/f and DTC for a while now. I have both been on the practical side and in the theory and fortunately I had some practical experience with electric motors (AC, DC-series, DC-Sep-EX), before dealing with the theoretical models. At the moment I am working in my free time on the control software expanding an AC-Induction-controller which has been used for Photovoltaic Water pumps into a traction controller for EV.
I think you are totally on the right way starting by implementing a closed loop U/f. It will help you create the frame for your motor control.
(U voltage, f= frequency)
You can start as you mention by implementing the pedal giving a certain torque (U/f proportion increase by pressing the pedal) and measure the DC-Bus voltage and actual speed to calculate the slip which you need to give the U/f proprtion increase. As long as you keep the working point in the constant power region of the motor curve you will get quite good efficiency (80%+). The constant torque region (torque and current maximal) producess heat losses and in the high speed region (field weakinening when max voltage is arrived) you have iron losses.
Be aware that the constant power curve changes due to applied voltage (shifts to left when voltage decreases and right when Voltage increases seen on a torque/ f -diagram).
To be sure to be always in the "best" working point you need motor knowledge either from saved working states or from a motor model

And therefore now to DTC (which is a subset of FOC). As you say you often get bad attitude, from academics especially I assume, if you say you do use U/f- instead of DTC.
Believe me, most of it comes of old or bad knowledge. If you are implementing a practical DTC it is basicly an advanced U/f with Space-vector Modulation (SVM). The advance implementation comes in three ways
1) You measure U-DC-Bus and the current of 2 or 3 AC-phases.
Instead of measuring only the motor-speed you measure the position also (with digital-encoder).
2) Instead of working from saved motor-curves-states you work from known motor parameters (stator induction, resistance and motor-inertia)
You use the Clarke-Transformation to transfer the 3-Phase AC-curent system into a two phase current system, where one current reflects the stator current and the other the armature current. This model is similar to a practical DC-Sep-Ex motor with one current in the seperate field inductor and the other current in the armature. From the 2 currents and the known resistive parameters you calculate the stator voltages for modulation and the torque. You have two ways of adjusting the torque/speed, one by changing the slip, the other by changing the stator voltages.
3) You could also make an time-invariant model of 2) with the Park-transformation which is in fact the classic FOC but today you can use fast ADC instead of coordinate transformation so I recomend skipping that and use a processor with fast ADC and model-calculation of momentan values instead.

Siwastaja
Junior Member

Last edited by gunnarhs; 08-14-2012 at 08:37 AM.
#8
08-25-2012, 01:36 PM
 circuit Member Join Date: Jan 2012 Location: EU Posts: 58
Re: VFD, FOC, DTC - back to the basics

Interesting topic, subscribing.

Please note that I am not a professional in motor control and all I say below may be not correct, this is as I understand it.
About the vectors from outer the space. Actually it does not have much in common with FOC. It is just the algorithm of switching power electronics to lower amplitude of PWM carrier harmonics. I mean, if you have all three channels switching off at the same time and then switching on at their corresponding duty cycle, you will get quite high EMI at the moment all three bridges switch. The buzz about space-vector-PWM is that it is center-aligned and no power switch goes up or down at the same time other does. Here is a picture from atmel's motor drive MCU datasheet:

This can also be observed from sound - standard PWM emmits a constant frequency sound and the SVPWM humms in wide frequency spectrum.
Or at least I have observed so.

I have a motor controller project myself. Started it in 2009:
Since its my hobby on spare time which I don't really have, it moves really slow. I mean like Mega Slow. I've gotten almost nowhere since then.

Anyway I am more interested in efficient/silent/cogless drive of an permanent magnet motors than induction ones. Have some ideas on waveform and BEMF shape matching, but never got to testing them.
__________________
Visit: e-motion blog | Linked-in profile
Personal project: Electric Peugeot scooter conversion

Last edited by circuit; 08-25-2012 at 01:39 PM.
#9
08-25-2012, 02:32 PM
 PStechPaul Senior Member Join Date: May 2012 Location: Cockeysville, MD 21030 Posts: 2,938
Re: VFD, FOC, DTC - back to the basics

Interesting videos on your youtube channel. I'd like to see more details of your motor experiment. I plan to do more with my SR motor soon, and there is a separate thread on that project. The drive electronics are a bit more complex, but the principles are rather simple, and the results are promising. However, for most DIY projects, the ACIM is probably most practical because they are so ubiquitous and easy and cheap to obtain, and the technology is well proven. I am not convinced that the complex measurements and control algorithms are really necessary, and I think the gains of efficiency and other factors may be minimal. But yet there must be some reason why there has been so much attention on these drives.
#10
08-27-2012, 12:39 PM
 gunnarhs Senior Member Join Date: Apr 2012 Location: Iceland Posts: 271
Re: VFD, FOC, DTC - back to the basics

Hi circuit and PStechPaul,

I think we aggree on most points here but please let me clarify for the topic starter why we should (or should not) use "fancy" control.

@PStechPaul
"But these can be adjusted as well, and the specifications for my drive show efficiencies of 90-97%"

I assume you are talking about the efficiency of your Inverter? There is a great difference in 90% and 97%. If you are working for example with a 100kW inverter 90% efficiency means you have to get rid off 10 kW heat , the 97% means you have to get away 3kW of released heat.
By using an advanced control, you are trying to keep the inverter over 95% efficient, most of the time over 97%. In a car with limited space and resources you have to minimize the cooling system so we are fighting for a few percentage here.

@PStechPaul
It is worth investigating is recreating a relatively pure sine wave to apply to the motor, rather than the direct PWM drive...
I propose adding LC filters to the motor leads to clean up the signal by removing the high frequency harmonics...

Yes this makes a great difference for the motor. But this is a feature added after the inverter stage to "smooth" the signal for the motor.

@circuit
"Actually it does not have much in common with FOC. It is just the algorithm of switching power electronics to lower amplitude of PWM carrier harmonics"

I assume you are talking about reducing the harmonic distortion by eliminating the outer switching states [000, 111] ? This is actually one part of the problem, the main problem is still the right modulation of amplitude and frequency of the output phases due to optimize the torque/speed relation in the specific voltage-space. This could mean for example the usage of more than one vektor during a sample period, an additional consideration of dead-time or any other correction.

Last edited by gunnarhs; 08-27-2012 at 01:30 PM.

 Share or Bookmark this

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General Forum     EV News     DiY Electric Car Forum Help Desk     Chit Chat EV Conversions and Builds     All EV Conversions and Builds     Technical Discussion     Batteries and Charging     Controllers     Electric Motors     EV Performance     Electric Bikes     Non Road Going Vehicles DIY EV Wiki     EV Information     DIY Wiki Discussion Production EVs and Hybrids     Production EVs     Production Hybrids Marketplace     Classifieds     eBay EV-Related Auctions     Parts Vendors     Professional Conversion Services     EV Dealers EV Clubs     Dallas EV Club     TexomaEV.com     EVAoSD     NEAA     NZEVA     B-EVA     UtahEVInterest External Information     EVDL List Vendors     Vendor Deals

Support DIY Electric Car