DIY Electric Car Forums banner

VFD, FOC, DTC - back to the basics

77K views 196 replies 19 participants last post by  stealthhack 
#1 · (Edited)
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 :confused:.

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 :D. 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.
 
See less See more
#2 ·
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 :)
 
#4 · (Edited)
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! :cool:

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
 
#36 ·
So in the end, to get a decent [V/f] system going, you need voltage sensors, current sensors, speed feedback and complex mathematical algorithms - and STILL it is an inferior control system.
My current inverter firmware is growing around V/Hz and uses an encoder to do slip control. I also modify the voltage for fewer losses at low slip (=torque) commands. It works well but has accumulated a considerable amount of parameters to be tuned until the throttle response works well.

End result of vector control is you get much better/advanced control of the motor ......and the code ends up being a lot smaller.
After watching it I implemented the FOC algorithm in around 4h and it turns out it is less code than slip control + V/f.

Hate to say it, but I told you so :)
I wasted too much time on an advanced slip control - I guess its the necessary learning curve though.

Glad to hear your still working on the controller
 
#5 · (Edited)
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?
 
#6 ·
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/sci.electronics.design/2005-07/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 · (Edited)
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
 
#8 · (Edited)
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:
https://www.youtube.com/watch?v=aKtDlISbxlw
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.
 
#9 ·
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 · (Edited)
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.
 
#11 ·
I'm very thankful for this thread :)

I too have not found a single paper on "closed loop slip control".
The only thing you ever get is "closed loop speed control based on V/f". All stating how "in a car controlling the speed with the throttle pedal is unpractical"... no shit, Sherlock?

I do believe that FOC is very powerful but I just can't wrap my head around it. Same goes for DTC even though it seems more universal.

So here's what I did:
- Implement the sine core just like Siwastaja but on an STM32
- Add the fancy space vector modulation (which is three f..ckn lines of code) for better bus voltage usage
- Saw some teeth in my shaft coupler:


and let them run through a light barrier:


costs almost nothing and gives me the rotors current speed.
- Map the throttle signal to a slip frequency (e.g. when rotor speed is 50Hz and throttle is at 100% output a frequency of 60Hz)
- At low speeds the rotor speed measurement is too slow so I just map the throttle to 0-5Hz and gently move over to slip control above that speed. Before I did this the motor/the car started very jerky, sometimes even the over-current limit of the IGBTs was hit.

I admit it does not work perfectly: It's hard to slow down, the motor pushes against the breaks. But I will eventually figure out solutions for that and I will actually know what I have done to fix a problem. No miracles, no vectors.

It's not too far off, this is closed loop slip control driving my car:
http://youtu.be/xkuDTby8pQw

I want to say it again: FOC and DTC are amazing pieces of science and they allow (as I've read) very precise control of the motor. But do we need this?
- Does your ICE car start smoothly from 0 speed? Mine doesn't it actually needs a clutch...
- Is the throttle response of your ICE linear and reproducable? That of my turbo diesel certainly isn't
- is that a problem? not to me

Now effeciency is often another argument for advanced control methods. But heres the deal with an ACIM: it isn't advanced, it follows simple rules: Too much slip because of too little flux -> you waste energy. Too much flux and hardly any slip -> you waste energy.
Interestingly the flux current set point in many FOC VFDs is set to a constant in which case FOC is hardly any more efficient than closed loop V/f. You can set "economy modes" which reduce the flux current. But that too isn't really what you'd call "advanced".

You can optimize slip and flux with V/f as well. It will take a lot of experimenting but thats what engineering is to me.

As opposed to the effiency of the motor, the effiency of the inverter is unaffected by the control algorithm. It is determined by the gate drivers, the switching frequency and the switching pattern. E.g. the SVPWM at full throttle will save 1/3 of the switching losses. Just look at it on a scope.

All this might not apply to performance conversions. I certainly believe it applies to commuters and town-runabouts.
 
#12 ·
jhuebner
Nice work here on your car, I see you are on the track.
By using a slip- AND a voltage control you have a simple DTC
(you can control speed and torque seperately)
You only need to balance it out by trying to minimize the slip by increasing the voltage if possible (try to keep the slip 2%-10% over most range)

Do not even try to do the "full torque at 0 rpm", it does not work with large motors under load. Torque-control starts to work at 10 Hz

@jhuebner
"Interestingly the flux current set point in many FOC VFDs is set to a constant in which case FOC is hardly any more efficient than closed loop V/f. You can set "economy modes" which reduce the flux current. But that too isn't really what you'd call "advanced"."

It is not so advanced indeed. But efficient use of "Field weakening" is what makes one of our car range 200 km instead of the proposed 150 km. And that with a simple SepEx-Motor, we are still building the AC-car which should perform even better.

@jhuebner
"You can optimize slip and flux with V/f as well. It will take a lot of experimenting but thats what engineering is to me."

Yes you can:) But if you know motor parameters you can make the experiementing easier.

@jhuebner
"As opposed to the effiency of the motor, the effiency of the inverter is unaffected by the control algorithm. It is determined by the gate drivers, the switching frequency and the switching pattern. E.g. the SVPWM at full throttle will save 1/3 of the switching losses. Just look at it on a scope."

Two different things:
1) Efficiency of the inverter - drives under optimal cirumstances (usually 95% plus) by sophisticated design and by using the SVPWM to eliminate unwanted switching states.
2) The main purpose of the control though is to minimize the current drawn under heavy load. If you can increase the voltage (instead of increasing the slip by slowing the frequence for more torque) you do that. More current in IGBT's means more heat, which means more losses. By using SVPWM you have the perfect tool to adjust that. So you are doing both motor and inverter a favour.
 
#14 · (Edited)
jhuebner said:
I admit it does not work perfectly: It's hard to slow down, the motor pushes against the breaks. But I will eventually figure out solutions for that and I will actually know what I have done to fix a problem. No miracles, no vectors.
Easy, just command a frequency that's less than the current rotor speed frequency. Be prepared for the DC bus voltage to rise as you are effectively regen'ing.


jhuebner
By using a slip- AND a voltage control you have a simple DTC
(you can control speed and torque seperately)
Gunnarhs, I think you are confused with the decoupling of torque and flux.
Changing slip AND voltage = changing frequency and voltage = v/f control = slip control.


jhuebner said:
do you dynamically weaken the field? thats a large increase indeed.
Field weakening allows you to overspeed the motor. i.e. when you have run out of voltage to give to the motor in your linear v/f fashion, you can still increase the frequency. As the flux is proportional to v/f, you are therefore weakening the field as you can no longer maintain the ratio.

jhuebner said:
Interesting that I'm already close to DTC without even knowing :) and without any feedback but the speed.
You definitely need current feedback from the phases! It will be very unsafe to push that much power without any form of current protection. I'm assuming you already have this though, along with the previously mentioned DC voltage sensing. Therefore you have more feedback than is required for vector control. You don't even need an encoder with sensorless vector control.


I don't know why people are so adverse to vector control. Why not get the FOC STM code from the Kiwi guys and be done with it? The code is professionally written, it works well, and most importantly its safe. Don't want unpredictable torque of slip control to rear end the guy in front of you in stop-start traffic.

I'm not trying to discourage you, i think your doing a great job and I'm pleased to see more people doing AC conversions. Slip control works, everyone knows this, but it is mainly used as a very primitive speed control to bring a motor up to speed (to limit inrush etc), which is designed to then run at a fixed line frequency. You cannot get torque vs current bang for buck, nor will you get optimum efficiency (without 5x the complexity of code and feedback of vector control), and your control over the motor will be crude.
Look it doesn't cost any more to put on vector:
-Rather than spend extra money on battery energy, make your motor control more efficient
-Rather than spend extra money on battery and silicon (mosfet/igbt) power, make your motor control more efficiently powerful (current bang for buck)
-Rather than crashing your car, wearing out your brakes against a motor still producing positive torque, and using trial-and-error experiments to get decent torque control, DOWNLOAD FOC! :D

haha

Bit exaggerated, but IMO, if your going to run v/f control, you'd be better off with brushed DC in terms of efficiency and performance.
 
#13 ·
Hey Gunnar,

do you dynamically weaken the field? thats a large increase indeed.

Interesting that I'm already close to DTC without even knowing :) and without any feedback but the speed.

BTW the source code is part of the tumanako project and can be found here. Not very pretty as of yet:
http://tumanako.svn.sourceforge.net/viewvc/tumanako/trunk/inverter/fw/motor_control/src/sine/

"Yes you can:) But if you know motor parameters you can make the experiementing easier."

Well call it "educated experimenting" then :)

No the full torque at 0 rpm is not a goal.

When I see an automatic commissioning machine race to a specific shelf stop right in front of it, take its payload, race to a different shelf, stop.... I know what 0 rpm torque and transient response is all about.

But if a car ever encounters a transient it will be the last one it ever sees :p
 
#17 ·
OK - thanks for your insight! Practice is what matters over theory.

I will promise you, I won't go into great lengths to fine-tune the "closed-loop slip control" algorithm. As I stated, it must be simple, otherwise there's no point. The idea is not to let the slip increase too much which would cause poor efficiency. This decision probably leads to a situation where all torque cannot be realized, just the nameplate value plus maybe 20-30%, unless efficiency is sacrified by going near breakdown torque.

If I then want more torque from the motor -- which will probably be the case as we are using a relatively small motor --, we'll just implement FOC or DTC rather than fine-tune slip control to more than 10 lines of code.

The good thing here is, the inputs and outputs are same for both so it's easy to change the algorithm.
 
#18 ·
There is one advantage to the closed-loop slip idea over DTC, which is you don't need accurate current sensing at all. IGBT desat should be enough overcurrent protection. It was almost enough seeing jhuebner's car to get me to try it, as the problem I'm having with my system is that my current sensing is not accurate enough for DTC. But, Stiive's pep talk has put me back on the righteous path :). Might take me a while to fix my current sensing, though.
 
#21 ·
What are your issues with current sensing?

What effiency figures are we talking?

In some ABB paper (http://www.hv-engineering.de/pdf/pdf_anleitungen/TechnischeAnleitungNr1.pdf page 21) It says you potentially save 10% @ 25% load and 2% @ 50% load.
It makes a difference for sure. But be aware there is no open source inverter as of yet. If the first one is supposed to be ultra-efficient there won't be one for a long time unless Stiive is a prodigy.

Slip control is crude, but its not a no-go (well nobody said that).

I've had the slip control do regen. Actually on the video it does regen when coming back down the slope.
I tried to get the car to coast when throttle=0 (without completely disabling the PWM). After that code change it simply stayed around 0 slip still feeding some torque to the brake disks.
 
#22 ·
Originally Posted by gunnarhs
jhuebner
By using a slip- AND a voltage control you have a simple DTC
(you can control speed and torque seperately)


@Stive
"Gunnarhs, I think you are confused with the decoupling of torque and flux.
Changing slip AND voltage = changing frequency and voltage = v/f control = slip control."

No I am not. Because I (and jHuebner also it seems) have the information about the currents from the phases for the SVPWM which allows us og controlling the Torque and Speed seperately.
(we could also use a motor model for prediction but as we have speed feedback and in my case also feedback of rotor-position, we use the info directly)

You have too look at the closed U/f loop as the outer loop of your system and (speed control) and just add a inner loop for the "correction" of the SVPWM which gives you the balanced Torque-speed-control but also the possibility to control it independently.

In the practical case it meens to adjust slip (torque) AND Voltage (speed), you can do it independantly up to certain limits (meening you cannot exceed 20% slip and you can not make more Voltage than the Battery supplies)
You say you like the theoretical implementation so here you are:
http://ljs.academicdirect.org/A18/027_044.htm
Pay attention to formula (8)-(10)
By actually applying a good slip-control you can minimize the torque-ripple and this actually works well:)
 
#26 ·
No I am not. Because I (and jHuebner also it seems) have the information about the currents from the phases for the SVPWM which allows us og controlling the Torque and Speed seperately.
(we could also use a motor model for prediction but as we have speed feedback and in my case also feedback of rotor-position, we use the info directly)
But DTC by definition is a vector control algorithm which decouples torque and flux. Not torque and speed. The algorithm you describe is not DTC. Although DTC stands for "direct torque control", it is a specific type of control, just because you can control torque does not mean you have implemented DTC.

What you and jhuebner describe is slip control with a torque input.
I admit, the naming of the algorithm is misleading because it is not the only method of controlling the torque of a motor.
 
#23 ·
@jhuebner
"do you dynamically weaken the field? thats a large increase indeed."

Yes when the motor exceeds base speed and the car is "cruising"

@jhuebner
"Interesting that I'm already close to DTC without even knowing :) and without any feedback but the speed."
Add the feedback of the current-measurement to "correct" your SVPWM and the you have it

@jhuebner
"BTW the source code is part of the tumanako project and can be found here. Not very pretty as of yet:"

I can give you the Siemens/Infineon code if you like (but it goes on a different processor, XC878. That is a modified U/f (with feedback, SVPWM, and current-feedback) and it works actually fine.

@jhuebner
"Well call it "educated experimenting" then :)"

Ha,ha I will, actually we did this once with a open loop (constant) V/f for water pumps, in that case it worked quite well. Had a total efficiency with our Inverter of 97% and totally outperformed Siemens Simovert with FOC. But only for this special case.

@jhuebner
"But if a car ever encounters a transient it will be the last one it ever sees"
Agree with you, full torque at 0 rpm sounds more like a stepper motor application
 
#24 ·
I can give you the Siemens/Infineon code if you like (but it goes on a different processor, XC878. That is a modified U/f (with feedback, SVPWM, and current-feedback) and it works actually fine.
I am building my BLDC controller for some time now. Coding is not my strong side, but I would be very interested in the code. Can you share it with me?
 
#28 ·
I am using a simple design to shift a +/- 2.5V signal to 0-2.5V for the ADC input of a PIC. The bipolar signal goes to two 3.0k resistors in series to the 2.50V reference. Thus at -2.5V the signal is zero, at zero it is 1.25V, and at 2.5V it is 2.5V. I'm measuring 60Hz true RMS AC current through a shunt, and I am able to get accuracy of 0.25% or better. ;)

The actual input from the shunt is processed by an INA129 Instrumentation amplifier and then a multiple gain amplifier using an LT1112, with 8 ranges in a 1-2-5 configuration so with a 1000A/100mV shunt I can read currents as low as 50 amps to a precision of 0.1A and as high as 10,000 amps. :)
 
#32 · (Edited)
By the way, https://www.youtube.com/watch?v=jnp2wOWdOXc shows what we have now. This is however a simple V/f drive. It does generate sine with 3rd harmonic, just like SVPWM does to better utilize DC bus. The PWM frequency goes along with the base frequency but takes one-octave steps in order to stay at the allowed limits, hence the sound. The sound is similar to some early VFDs which were apparently done in the same way.

I feel that we are starting to grasp the concepts of FOC and DTC finally, piece by piece. I have to say that all information is quite obfuscated in their nature; and, it is really crucial to understand how the ACIM actually works on a level that is not explained, for example, in Wikipedia at all.

I have a question to any motor gurus here. Is this the correct explanation of what basic task both FOC and DTC try to achieve in order to increase efficiency and power factor:

All electric motors have two magnetic fields, and they produce torque by having these fields oppose & attract each other, think two magnets. Now, in order to use their magnetic fields fully for this purpose, these fields must be at a 90 degree angle relative to each other. In a series DC motor, this happens automatically by mechanically connecting the brushes. In a PMAC/"BLDC" motor, this happens by using a position sensor. However, in an induction motor, we can't exactly know this angle. It is not related to the actual rotor angle, nor it is exactly related to slip.

Now, it is important to understand that the rotor-generated magnetic field is synchronous to the stator-generated magnetic field. Hence, they both rotate at the same speed. And here we need the same 90 degree angle as in brush-DC and PMAC/BLDC motors between these fields that are stationary with regards to each other.

So, in normal nameplate conditions (speed, load, power), the ACIM tends to stabilize to a slip, voltage and current situation where the angle between the two stationary fields is the desired 90 degrees. If it isn't 90 degrees, all energy is not converted to torque; instead, it is bounced back to electricity, but with some losses which is mostly seen as dropping power factor. Also, this limits the maximum power available.

In ACIM, the process is of course self-regulating; if the angle between the fields is 0 degrees, it generates no torque and the angle increases when torque is needed. Therefore, the angle is closely related to slip (speed difference between rotor physical speed and rotor field speed, later of which is same as stator field speed). Still, it's not the same thing.

Hence, the better solution than the slip control proposed by me in my first post, might be to keep the slip at optimum slip point (as in nameplate) and vary voltage and current instead. Like this: if there is too much slip, the angle is likely to be more than 90 degrees --> increase voltage to strengthen the fields to reduce slip. If there is too little slip, the angle is more likely less than 90 degrees (a low power factor is seen, like with unloaded ACIM driven from the mains); decrease the voltage to weaken the fields and increase slip.

However, I also understand that the angle difference between the fields is not 100% directly related to only the slip. Here comes the FOC -- the purpose of which is to approximate the angle taking all parameters into account, and set it to exactly 90 degrees, and in addition allowing the used to adjust the magnitude of rotor and stator fields, the directions of which have been taken care of by the algorithm.

Am I right here? Any comments? Any missing points?
 
#33 · (Edited)
Am I right here? Any comments? Any missing points?
Yes you have got it right. Now it is just about the implementation. Here some user cases:
1) BLDC/PMSM. Here FOC is very desireable because these are synchronous machines and you have a stationary magnet for example in the rotor. For a small motor with little load and/or little dynamic change requirements you can also skip the speed/position sensor. You only have to control the (decoupled) stator flux amplitude until you reach the base speed (rotor flux remains constant in this case). Lets stop here with PM-machines

2)ACIM. Here FOC WITH current/speed/position-feedback is the best universal control but not necessary the best for each special case. It depends on the dynamic-response requirements. That is the reason for the implementation of DTC which uses the first step of FOC at least ( Clarke 3->2 conv).
In this case to make a good torque-control, slip has to be taken into account when adjusting the decoupled torque-components (T, rotor current and stator-current ) AND motor parameters when adjusting the speed (w) resulting the power (P), P = T x w.
If rotor and stator field are only coreccted in respect of amplitude as in classic FOC it will correct the slip but with high torque ripple.
The DTC will have less torque ripple with speed/position/current - feedback but needs good sensors and accurate motor model otherwise it has low power factor due to "overslipping".
I have referred to http://ljs.academicdirect.org/A18/027_044.htm for better understanding how to relate slip to torque-control (Equation 10).
Figure 5 shows the d/q frame with the projection of the stator/rotor vektors with slip-correction and Figure 11 shows the time-variant (!) stator and rotor currents from the Clarke-Transformation.
So the question is what are your requirements, universality (FOC) or high dynamic response (DTC with application specific modification)?
I assume the DTC because we are in an electric car thread...:)
 
#35 ·
I want to add some of my findings, even though this thread is rather old..

My current inverter firmware is growing around V/Hz and uses an encoder to do slip control. I also modify the voltage for fewer losses at low slip (=torque) commands. It works well but has accumulated a considerable amount of parameters to be tuned until the throttle response works well.

So, after reading 50+ papers on FOC all covering the same details with hideous formulars, I finally found a source that explained FOC to me in an understandable manner: http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT111008

Its a video that explains e.g. the Parke transformation as "jumping on a spinning carousel". No fancy math, no greek symbols. I like that.

After watching it I implemented the FOC algorithm in around 4h and it turns out it is less code than slip control + V/f. In the simulation environment it works well, will test it on the inverter these days.
 
#37 · (Edited)
Again -- this video is so last season, I've seen it over and over again. It's about permanent magnet FOC which is a completely different beast.

There's nothing difficult in Parke-Clarke-Einstein-Space-2000-Transformations (it's the part common with PMAC and ACIM FOC -- the trivial part), they are just obfuscated coordinate transformations and you don't need to think about those too deeply, yes, you can just pick the code that does the job.

The problem is that the ACIM FOC has many black boxes, most importantly, the rotor flux estimation (the problem skipped in PMAC FOC the video is about). This part is also sensitive to adjusting all the parameters. According to Wikipedia, at least rotor inductance and rotor resistance, which greatly varies with temperature. You can find that FOC is sensitive to temperature variations and I've seen no open-source implementation of exact algorithm that does the rotor flux estimation. It seems you are missing this part completely, while it is the "meat" of the ACIM FOC.

Generally, physical modeling can lead to best results, but the model needs to be very accurate, otherwise, small errors can cause large mistakes. Simply put, you need to have BOTH the model AND the input (both physical parameters and measurements) just right.

The beauty of simple slip control is that it doesn't rely on the complex model in order to create optimal slip; it directly does it, the slip is given as a parameter. While without modeling we cannot have 100% optimal slip (because we don't know what's perfectly optimal), it should be near to it, and what's best, a small modeling error or temperature shift won't wreck havoc.

How do you tune FOC parameters? Do you know that there are complete books on the subject? Indeed, FOC tuning is a crucial part of FOC algorithm, again, always omitted when talking about how "FOC is so easy, just do the math transformations". Without it there is no usable FOC. There seems to be reasons why some people prefer DTC instead; it tries to be self-tuning at the runtime.

At least I understand what "slip" is and I can easily increase or decrease it.

Stiive, have you really implemented ACIM FOC that really works and gives better results than simple slip control?

If this is a "it just works" type of thing as you claim, then please cut the BS and show the code! :D
 
#38 ·
The video might be last season but still contains valid information. But you're right, for an ACIM its not that simple.

For a PMSM with some sort of shaft sensor you can run foc without any motor parameters. That was new to me.

I was rather disappointed when I learned that this is not true for asynchronous motors.

So that said, maybe there is a point to run slip control after all.

In the tumanako repository there is an implementation of a simple slip estimator. It works with a fixed rotor time constant. I don't know which is better: foc with errornous time constant or slip control?

https://github.com/tumanako/tumanak...ol/blob/master/src/slip_estimator/SlipAngle.c
 
#39 · (Edited)
The video might be last season but still contains valid information. But you're right, for an ACIM its not that simple.

For a PMSM with some sort of shaft sensor you can run foc without any motor parameters. That was new to me.

I was rather disappointed when I learned that this is not true for asynchronous motors.

So that said, maybe there is a point to run slip control after all.

In the tumanako repository there is an implementation of a simple slip estimator. It works with a fixed rotor time constant. I don't know which is better: foc with errornous time constant or slip control?

https://github.com/tumanako/tumanak...ol/blob/master/src/slip_estimator/SlipAngle.c
FOC for PMSM always needs current feedback (at least 2 phases for a 3 phase motor) and the same can be done with induction motor to force a constant slip (fixed torque, variable speed application for example).
Unfortunately in the vehicle we need variable torque (and also controlled speed for more efficiency) and this complicates the matter.
As I have previous mentioned you always need to take slip into account to "correct" your FOC for induction motor if you want better efficiency.
I would not trust the fixed rotor time constant in the code above but rely more on slip measuring if I had to choose.
Myself I have used a V/f with current and speed feedback (and recently encoder postion to to make use of Space Vector Modulation). This has worked very well for all standard induction motors but I have had problems with the Siemens Motor 1PV5135 which has very high inertia and anothers members (Stiive) inverter which uses basic DTC (as far as I know) seems to handle it much better in terms of speeding it up.
 
#43 ·
Next step is looking at the code ( by the way one of the most readable codes I have seen for FOC , nice job here, mine is more messy )
But I will allow me one change, please let me know if you want to try it out or if you think this is no use for you
Code:
//important this comes from the same interrupt
 
extern SlipAngle(double ia, double ib, double sPWM, double tRotor);
extern PWM_FREQU; // for example 50 Hz for 3000 rpm for 2 pole motor
extern ROTOR_FREQU; //the measured load frequency
 
void foc_step(FOC_DATA *fd)
{
    //Clarke transformation gives us 2 phases which are in the ideal model
    //stator and rotor components, two sinus currents with 90 degree shift
   
   fd->ia = fd->il1;
   fd->ib = FP_MUL(sqrt3inv1, fd->il1) + FP_MUL(sqrt3inv2, fd->il2);
 
   //Slip correction
 
   //SlipAngle = Stator Angle + deltaSlip due to new PWM_FREQU
   
   fd->Angle = SlipAngle(fd->ia, fd->ib, PWM_FREQU, ROTOR_FREQU);
   
   //assuming ia is our stator reference and ib our rotor reference
   temp_ia = fd->ia;
   fd->ia =  fd->ia + temp_ia * cos(fd->Angle);
   fd->ib =  fd->ib + temp_ia * sin(fd->Angle);
 
   //No Park transformation it delays the slip info and sensor info
    
   //Maybe additional correction by allowing more slip, could reduce ripple
   //see [URL]http://ljs.academicdirect.org/A18/027_044.htm[/URL]
 
   //PID controller
   s32fp newia = CalcPID(fd->ia - fd->ia_spnt, &fd->ctl_a);
   s32fp newib = CalcPID(fd->ib - fd->ib_spnt, &fd->ctl_b);
 
   //Inverse Clarke transformation
   int32_t ul1 = newia;
   int32_t ul2 = FP_MUL(-FP_FROMFLT(0.5), newia) + FP_MUL(sqrt3ov2, newib);
   int32_t ul3 = FP_MUL(-FP_FROMFLT(0.5), newia) - FP_MUL(sqrt3ov2, newib);
 
   int32_t ofs = CalcSVPWMOffset(ul1, ul2, ul3);
 
   fd->dc[0] = ul1 - ofs;
   fd->dc[1] = ul2 - ofs;
   fd->dc[2] = ul3 - ofs;
}
This is an even shorter code but may be need correction.
 
#44 · (Edited)
Our super duper simple slip control is working perfectly fine. Absolutely nothing to complain about at this point. (We need to build the proper motor mount however!)

It gives very nice throttle response, full torque from zero, and easy control of speed even at very low speeds. Efficiency cannot be so poor; the controller has passive cooling with no fans and it is only warm to touch after 4-5 km of test drives. Motor does not have any cooling either and it's just barely warmish.

Regen is able to stop the car completely. It was very aggressive so we limited it quite a bit.

See the videos:

http://www.youtube.com/watch?v=daYXNsyvWhg

http://www.youtube.com/watch?v=KaCTVe_FCYg

We are currently very limited in voltage due to budget reasons. We designed the motor (rewound motor) for 320V, and even that did not include any leeway for momentary acceleration at higher speeds, and now we are at 96V minus sag. This limits the electrical power to about 10 kW and top speed to about 50 km/h. So we haven't yet been able to demonstrate how the motor performs during the "real deal", which is overclocking to 150Hz, producing 25-30 kW out of a 7.5 kW industrial motor. But the control algorithm clearly works - and what's best, it indeed is very simple, about two orders of magnitude simpler than a proper FOC.


Constants shown are the actual values used in the video. Numerical ranges are examples of "typical" values. Constant multiplicants (mostly bit shifting) omitted from the picture.
 
#72 ·
Our super duper simple slip control is working perfectly fine. Absolutely nothing to complain about at this point. (We need to build the proper motor mount however!)
Congrats to your project and respect for carrying on your concept and improving your (and our) knowledge on VFD use in EV!

As I suggested in my first post here in the thread you have created a frame for your drive-train and you can now continiously improve it. But what is more important is, as you point out, to get a understanding of the basic problems of the motor which do cause the same problems regardless of control-type
(temperatur, inertia etc)

In my case I have chosen to improve the VFD (V/f) by adding a current control based on the same concepts like DTC (using Space vector Modulation and Clarke-transformation but not Park which in my opinion is the distinction between DTC and classic FOC) to improve handling load changes. This has been working well for standard industrial motors of size up to 15 kW (I use maximal 2 x to get maximal power, in this case 30 kW).

Recently I have been testing another motor from Siemens which has much more power and unfortunately a lot of inertia and I have not yet beeing able to control it like I would like (before putting it into a vehicle). So there is always a way to improve the concepts and there is no one way to do it in my experience.

So good luck with further progress on this ...:)
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top