# 3-phase DTC-SVM induction motor drive design



## Stiive (Nov 22, 2008)

Hi,
I'm about to implement a 3-phase IGBT based sensorless DTC-SVM induction motor drive and was wondering if someone here (or know of a project somewhere) has already done similar. Would be great to compare schematics and/or code with someone who's already got a working system.

I have got my C code running my induction motor flawlessly using the Induction motor on SimPowerSystems. To reduce costs, my plan is to use a couple of fast micro controllers to run the code (one for d-q transforms and one for lookup) as i have eliminated all FFT and therefore hopefully will be fine without a DSP.

I have some 600V 600A IGBTs that i'll probably end up using, depending on the final design.

I am aware of the Tumaniko KiwiAC project, but that uses FOC which obviously has different requirements in hardware/software. However, FOC would still be useful to compare notes on areas such as; size of capacitor bank, snubbers, water cooled heatsink CFD designs, current/voltage sensor, procurement etc

Cheers


----------



## bjfreeman (Dec 7, 2011)

long thread few years
*Converting 2001 Passat *


----------



## Stiive (Nov 22, 2008)

Thanks for the link. 
I remember reading about this project a few years back. I will give him a PM.

Anyone else?


----------



## JRoque (Mar 9, 2010)

Hi. Forum member jhuebner is also working on the Tumanako project and might be able to help cross-checking your work.

How are you passing data between the two micros? Is that link going to be quick enough? I've also wondered if one micro with enough local memory can do both main code and lookup tables. They make them now with up to 256Kb and more for higher bit counts.

Have you looked into Microchip's DSPic chips? Those are not that expensive and combine both needs into one die.

Last but not least, are you planing on contributing your design to forum members or commercialize it?

JR


----------



## Stiive (Nov 22, 2008)

JRoque said:


> Hi. Forum member jhuebner is also working on the Tumanako project and might be able to help cross-checking your work.
> 
> How are you passing data between the two micros? Is that link going to be quick enough? I've also wondered if one micro with enough local memory can do both main code and lookup tables. They make them now with up to 256Kb and more for higher bit counts.
> 
> ...


JR,
Thanks for your response.
I was looking at using 2 80mhz MCU demo boards. Alot of the data can be sent in parallel using a few ports each and would just be the output of the hysteresis controllers (0-4), flux sector (0-5) and angle (if you are familiar with DTC operation). Other information for debugging or advanced features can be sent in serial.
Because the control is SVM, this is perfect for two processors (or dual core), with the first CPU computing the preview vector, and the second implementing the smaller vectors. Infact i originally started design using the 8core propeller MCU, but hated the language so scrapped that.

The DSPic is definitely the path I will go down once I have proven the code, and finalised PCB design. If i could find a cheap DSPic 70MIPS demo board then maybe i would use that straight up.

Not gonna be selling these, don't own the right to DTC patents. Maybe I would give the design upon completion of a electrical theory and safety test lol. Don't want anyone killing themselves over a schematic i've given them.

If there's interest, might create a youtube series on the build. Have already done the model in simulink (started with blocks then replaced with code), Solidworks design of the finished product, CFD on the water-cooled heatsink, and eagle PCB surface mount design of the finished board if it all works as expected.


----------



## bjfreeman (Dec 7, 2011)

might look at the STM3F4 series.


----------



## Tesseract (Sep 27, 2008)

Stiive said:


> Hi,
> I'm about to implement a 3-phase IGBT based sensorless DTC-SVM induction motor drive and was wondering if someone here (or know of a project somewhere) has already done similar. Would be great to compare schematics and/or code with someone who's already got a working system.
> 
> I have got my C code running my induction motor flawlessly using the Induction motor on SimPowerSystems. ...


Ambitious project with some heavy duty simulation and code generation firepower behind it. Unfortunately, no one else in the DIY scene that I am aware of has the $25k worth of software you seem to have at your disposal to tinker around with this stuff. I certainly don't...

That said, I did a lot of research on DTC vs. FOC about a year and concluded that DTC offers no compelling advantage over FOC. Both schemes are kind of kludgy in my opinion (way too much reliance on "estimation" and "modeling" of critical parameters) but DTC is a variable switching frequency scheme by nature and that presents some monumental obstacles from a hardware design standpoint. For example, the amount of DC link capacitance is inversely proportional to switching frequency.

Also, the flux and torque estimator for DTC needs to know the stator voltages and currents. Obtaining the current is relatively straightforward, but measuring the voltage on each phase without distorting it from filtering while also needing to heavily filter out the inevitable noise and ringing from the waveform is _exceptionally difficult_.

I thought DTC was the greatest thing since sliced bread at one time... not so much anymore.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> might look at the STM3F4 series.


Wow, love the specs... Havn't had much experience with ARM, can i program this in C? I HATE assembly ... I have already written everything in C, changing it over with no way of simulation testing could be very costly to my IGBTs!


----------



## Stiive (Nov 22, 2008)

Thanks for your post



Tesseract said:


> That said, I did a lot of research on DTC vs. FOC about a year and concluded that DTC offers no compelling advantage over FOC. Both schemes are kind of kludgy in my opinion (way too much reliance on "estimation" and "modeling" of critical parameters)


DTC requires only the knowledge of stator resistance - unless your doing some advanced sensorless speed estimation



Tesseract said:


> DTC is a variable switching frequency scheme by nature and that presents some monumental obstacles from a hardware design standpoint. For example, the amount of DC link capacitance is inversely proportional to switching frequency.


Excactly why i was hoping someone else had done this before  My plan is to just over compensate. With my model I can find the usual switching frequency bandwidth for the motor, and work from there.



Tesseract said:


> Also, the flux and torque estimator for DTC needs to know the stator voltages and currents. Obtaining the current is relatively straightforward, but measuring the voltage on each phase without distorting it from filtering while also needing to heavily filter out the inevitable noise and ringing from the waveform is _exceptionally difficult_.


Yup, spot on. The voltage sensors have been causing me headaches... Might just keep it simple in the end with an opamp circuit and see how it goes. I am also working on some code to hopefully eliminate this voltage requirement completely (or atleast reduce its sensitivity).




Tesseract said:


> I thought DTC was the greatest thing since sliced bread at one time... not so much anymore.


Unfortunately I need DTC for my project otherwise I prob woulda just modified an industrial VFD, that seems the easiest. I have a Rockwell PowerFlex 7.5kW drive that would have been great to hack.

That being said, I still think DTC is easier than FOC for the DIYer - but time will tell!


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Wow, love the specs... Havn't had much experience with ARM, can i program this in C? I HATE assembly ... I have already written everything in C, changing it over with no way of simulation testing could be very costly to my IGBTs!


Yes C. You get a free library you can read on how to use the board.
It comes with header pins to you can put it on a proto board an wire to it. I use header sockets, so I can unplug the board for my different projects.
I use Eclipse as my IDE and tool chain.
here is the forum


----------



## Tesseract (Sep 27, 2008)

Stiive said:


> DTC requires only the knowledge of stator resistance - unless your doing some advanced sensorless speed estimation


I don't know about DTC only needing to know the stator resistance - there are many variations on the original scheme, you know, including marrying it with SVM - but either way the stator resistance changes with temperature and that was what I was getting at when I wrote that it's performance depended heavily on modeling/estimation.

Parameter shift causes all sorts of headaches for both DTC and FOC schemes, so I'm not singling out DTC here.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> Yes C. You get a free library you can read on how to use the board.
> It comes with header pins to you can put it on a proto board an wire to it. I use header sockets, so I can unplug the board for my different projects.
> I use Eclipse as my IDE and tool chain.
> here is the forum


Well, so far looks like this is my new choice  Do i need a new crystal to get the 168Mhz?
I hadn't done much research on what board/processor to get yet, but this is looking pretty much bang on what i originally wanted. I had been overlooking ARM so far because the last time i used one i had to program in ASM, and it made a job that should have taken a few hours take a few days!

I use Eclipse for Android software development.. maybe i should control my motor using the accelerometer in my phone 

Thanks for the info though, very much appreciated


----------



## Stiive (Nov 22, 2008)

Tesseract said:


> I don't know about DTC only needing to know the stator resistance - there are many variations on the original scheme, you know, including marrying it with SVM - but either way the stator resistance changes with temperature and that was what I was getting at when I wrote that it's performance depended heavily on modeling/estimation.
> 
> Parameter shift causes all sorts of headaches for both DTC and FOC schemes, so I'm not singling out DTC here.


I think you'll find that the original DTC scheme and infact the majority of variants (including SVM) can be implemented with only the stator resistance and its actually surprisingly un-sensitive. I don't see this as becoming an issue. SVM can also be used to help keep the switching frequency constant

FOC is another ball game due to its feed-forward control loop and requirement of nearly all parameters of the motor.

Your absolutely right about the phase-voltage though, and this is still stumping me as i want the HV and LV to be completely isolated. I believe i can rid of this requirement by either using an encoder, or some fancy maths.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Well, so far looks like this is my new choice  Do i need a new crystal to get the 168Mhz?
> I hadn't done much research on what board/processor to get yet, but this is looking pretty much bang on what i originally wanted. I had been overlooking ARM so far because the last time i used one i had to program in ASM, and it made a job that should have taken a few hours take a few days!
> 
> I use Eclipse for Android software development.. maybe i should control my motor using the accelerometer in my phone
> ...


 No read *system_stm32f4xx.c
*The reason I chose it is my 56F103 is 16bit 80mhz DSP. The is a 32 bit at twice the speed.

I also build gaming perhiperals so using the accelerometer on a glove with strain guagues on fingers for control, to replace my joystick.
also take adantange of the Dual Can to run the class B an C msgs. Added a wifi on the SPI to allow any computer to hook up an interact through a browser.
I use the SDIO for storage of files on a 16Gig SD.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> No read *system_stm32f4xx.c
> *The reason I chose it is my 56F103 is 16bit 80mhz DSP. The is a 32 bit at twice the speed.
> 
> I also build gaming perhiperals so using the accelerometer on a glove with strain guagues on fingers for control, to replace my joystick.
> ...


Wow that sounds awesome. I feel like I should buy one (or two) right now to have a play. Even if i don't use it for this project (though i can't think why not), I'm sure I'll find some use for it!

Are you using this to control a motor? Do you have a link to a thread/details?


----------



## bjfreeman (Dec 7, 2011)

My current 3 phase AC 250KW controller uses the 56f103.
I just got the STM32 Discovery. Busy prototyping the PCB with Eagle. 
I am in the processes of porting over the code, module by module and testing on my new mock-up. I expect it will be tested about this time next year.
this is my overall design. I am HEV not EV. This is more how the commercial guys do things.


----------



## bjfreeman (Dec 7, 2011)

you mentioned monitoring voltage. you might find this useful.
http://roadwarrior.free-man.com/can/rvcan/MeasuringVoltsandampstheCanBusway.shtml


----------



## Arlo (Dec 27, 2009)

Cool I would like to see the code and some scematics if possible. I can link my BLDC controller thread if you like. I am planning to spend next winter writing code to make it better. I have only just got the code good enough to run it sensored with no feed back (open loop).


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> you mentioned monitoring voltage. you might find this useful.
> http://roadwarrior.free-man.com/can/rvcan/MeasuringVoltsandampstheCanBusway.shtml



I don't quite understand whats going on here.. Both the CSLW6B40M and ACS712 are current sensing modules.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> My current 3 phase AC 250KW controller uses the 56f103.
> I just got the STM32 Discovery. Busy prototyping the PCB with Eagle.
> I am in the processes of porting over the code, module by module and testing on my new mock-up. I expect it will be tested about this time next year.
> this is my overall design. I am HEV not EV. This is more how the commercial guys do things.


What control method are you using on your current controller? Whats going to be different in the version? Faster sample rate with the new chip?


----------



## Stiive (Nov 22, 2008)

Arlo said:


> Cool I would like to see the code and some scematics if possible. I can link my BLDC controller thread if you like. I am planning to spend next winter writing code to make it better. I have only just got the code good enough to run it sensored with no feed back (open loop).


Yeh a link would be good. Did you build the hardware yourself?
Im still working on my schematic with all the recent changes i've been making. Will prob put it up soon for feedback


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> What control method are you using on your current controller? Whats going to be different in the version? Faster sample rate with the new chip?


the throttle is can msgs from the TCM, or the Joystick. 
the Motor is half bridge with dual encoder feedback.
It currently has two winding halleffects and temperature sensing.
I want to add more sensing, upgrade to CAN 2.0 
Lastly I have to build 3 more, so decided it was time to upgrade. Just could not find the Micro to do it Till the STm32f4


----------



## Arlo (Dec 27, 2009)

Here is the link and as you can see its all open and I have had a lot of help. IM still working on it and learning as I can. I have a long way to go but Im to busy to do to much till fall. http://endless-sphere.com/forums/viewtopic.php?f=30&t=30851


----------



## bjfreeman (Dec 7, 2011)

I am still editing the page on the controller.
However it will give you an idea and information.


----------



## PStechPaul (May 1, 2012)

While looking for information about this sort of project, I found the following links which may be helpful. 
http://curmot.eie.fceia.unr.edu.ar/Material/TorqueControl_FOC_DTC.pdf
http://courses.engr.illinois.edu/ece432/other/Sorchini06.pdf
http://www.waset.org/journals/waset/v45/v45-54.pdf
http://iaesjournal.com/online/index.php/IJPEDS/article/download/141/pdf
http://www.idc-online.com/technical_references/pdfs/electrical_engineering/Simulation%20and%20Analysis%20of%20SVPWM%20Based%202-Level%20and%203-Level%20Inverters.pdf
http://ljs.academicdirect.org/A12/035_056.pdf
http://www.vnulib.edu.vn:8000/dspace/bitstream/123456789/1921/1/sedev1206-04.pdf
http://icee2007.dei.uc.pt/proceedings/papers/380.pdf

I was thinking of designing my own VFD but I think it is beyond my abilities for anything more than a very simple implementation. So these links are only raw information that may prove useful. Good luck with your project. I will follow it with interest.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> you mentioned monitoring voltage. you might find this useful.
> http://roadwarrior.free-man.com/can/rvcan/MeasuringVoltsandampstheCanBusway.shtml



Hey mate, can you please explain the working of this volt-meter? Still stumped


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Hey mate, can you please explain the working of this volt-meter? Still stumped


it is a current hall effect (100 amp) with two Hall effects on each side to act as voltage sensors.
it is powered by 5volts and gives a 0-2.5 volt output.
the resistors have to be calculated to give a 5-10volt reading across the Hall device at 40ma.
Hope I was clear enough, I have a habit of not explaining fully.


----------



## PStechPaul (May 1, 2012)

I was also wondering about the voltage sensing for this. From what I can see from the schematic and layout on http://roadwarrior.free-man.com/can/rvcan/MeasuringVoltsandampstheCanBusway.shtml, there are two hall-effect devices on either side of a current sensing coil, and I assume this measures the main DC supply from the battery pack. I don't know the exact voltages and currents involved, but I would imagine at least 400 amps and 600 VDC (240 kW) since IIRC you have something like a 500 HP motor on your RV.

So, my first question would be how the PCB can handle the 400 amps of current. And my second question is the voltage and power rating of the resistors for your voltage sensors. If the hall effect sensors have a 40 mA coil, then the resistors would need to be rated at 600*0.04 or 24 watts, and also must be rated for 600V, which may require several in series.

There are hall effect voltage sensors which operate on 10mA which would reduce the power to 6 watts. http://www.bbautomacao.com/home_hall_effect_voltage_sensor_product_CYHVS025.html

Another question is why it is necessary to measure the input and the output, since there is only the sense coil in between, which should drop only 100 mV or less (and even that is 40 watts). 

If you have external shunts or voltage dividers, then I can understand how this might work. But otherwise I, too, am stumped.


----------



## bjfreeman (Dec 7, 2011)

There are other Hall sensors that are good to 1000 amps. as I mention. This is meant for a 70 amp charger.
I am about to make the ones for the AC controller that sense the Current in the Bus bars.
it is on my list of lists, of my some, 15 projects I am involved in.
the sensor you reference requires a DC-DC for plus/minus 15v.
I find it interesting that someone worries about 60watts when the system deal with 250KW.
ever see the ceramic wire wound resistors?


----------



## JRoque (Mar 9, 2010)

Hi. Last time (many moons ago) I used those Allegro sensors, I ended up soldering the bus wires directly to the sensor terminals instead of using the PCB traces. A direct connection from a bus bar would work well too.

How's the accuracy on those parts? IIRC they use the same part die for the different models and amp it to match the different current handling. That means the higher the current rating, the lower the precision. Could be good enough for the application though.

JR


----------



## aeroscott (Jan 5, 2008)

This is very interesting , not that I grasp it all . I stumbled across 3 monster GE current transformers (type JCT-0) . 16 lbs for the 3 , I was thinking that they were only for AC since under BIL10 KV was 50-400 hz . Googled it and found it is AC/DC hall effect 800 amps . The verity of these units blew me away (huge list ) both voltage and amperage . Looks like I need to spend some serious time studying halls .


----------



## PStechPaul (May 1, 2012)

I found a nice application note on current sensing:
http://cds.linear.com/docs/Application Note/an105.pdf

Here is an app note from Maxim showing how to achieve 1000V common mode using an optoisolator:
http://www.maxim-ic.com/app-notes/index.mvp/id/1867

Here is a unidirectional high side monitor for up to 100V in an SOT23 package, about $5 each:
http://cds.linear.com/docs/Datasheet/6101fh.pdf

There is a Supertex HV7802 which works up to 450V:
http://www.supertex.com/pdf/datasheets/HV7802.pdf

I prefer low-side monitoring, but the negative side of the battery must be connected to ground through a shunt. Otherwise, hall effect sensors are available as closed toroid CTs or clamp-on types. There are also non-Hall types. To measure true-RMS, you still need to use an RMS converter IC or fast measurement and mathematical computation. It is probably not critical for battery current and voltage.


----------



## Stiive (Nov 22, 2008)

I'm still confused, are we measuring the current through a known resistance to get voltage?
What am I missing here?

Ideally i want to scale my AC voltage (say +-400V) so that -400VAC gives a 0V reading to my MCU, 0VAC gives a 1.8V reading to my MCU, and 400VAC gives a 3.8V reading. Ideally I also want this isolated. I say AC voltage to differentiate from the ADC voltage, but it really needs to just be an instantaneous snapshot of voltage between the phase and DC-.

I can easily do this by using an opamp, but then i have to isolate it using something like the HCNR200/1. If there's a way to get this voltage reading using a bunch of current sensors, maybe that's easier? Atleast it'll be isolated, but i don't really want to add resistors between the phase and DC- though, if that's whats being suggested?


----------



## PStechPaul (May 1, 2012)

The monitor I built uses a differential amplifier with 475k input resistors which should read up to 450VDC. It is designed for an output of 0-4.5 VDC with a gain of 1/100. To read AC, you can offset the output of the op-amp using a resistor divider to the +Vref, in my case 5VDC. So, -5V gives 0 volts to the ADC, 0V gives 2.5V, and 5V gives 5V. You just subtract the offset when you read the ADC, and get samples representing the AC waveform.

I use this method in my Ortmaster, and it works well with an accuracy of better than 1%, and can read current from about 5 amps to 10,000 amps using a 1000A/100mV shunt. Without the shunt, it has a 2k input resistance, and 8 ranges from 5 mV to 1V full scale, and adding two 500k resistors will give you 2.50V to 500 V full scale. I'm using 2400 samples/second and I calculate the true RMS value. It is displayed 3 times/second, and it also captures the waveform of a current (or voltage) pulse up to several seconds long, and it can be displayed and analyzed like a DSO. I can provide more details if you're interested, and I have some old PC boards which work on a parallel port, which you can have for just the cost of postage.


----------



## bjfreeman (Dec 7, 2011)

There are many ways to arrive at a solution.
there are two basic approaches:
1) use hardware like comparators, IC's 
2) use Micros with minimum hardware.

I am of the Second Camp.
I started with 8bit 2mhz processor in the 70's to do filtering of signals. It was quite doable. Now I have a 168 Mhz DSP, with FPU, I have the world by the tail.
So my criteria is to isolate input from the micro, that can respond fast enough to give reliable data.
Next I segment the Controller into 3 groups, not counting the motor.
1) Control unit
2) Drive management
3) Power Stage

#1 is the Micro Hardware an all the sensor inputs and control outputs. like AD/DA, and Digital.
#2 is Micro firmware, that Monitors, Filters, Controls through #1
#3 is the actual Hardware takes the DC converts it to AC (under micro control) an delivers it to the Motor.
#1 and #3 have to marry in a way that they are electrically Isolated. Which is the reason for Hall effect sensors, an Opto Isolated devices.
So if others want to talk about using only hardware, I will not respond, but it is a valid design.


----------



## bjfreeman (Dec 7, 2011)

bjfreeman said:


> There are many ways to arrive at a solution.
> there are two basic approaches:
> 1) use hardware like comparators, IC's
> 2) use Micros with minimum hardware.
> ...


#2 has many modules
1) Start up parameters
2) Drive Setting.
3) monitoring different points in the system and filtering, through code, the inputs as required. Like voltages, currents, motor Speed an postiion sensors and input of desired frequency the motor should have.
4) the control of the motor based on #1-#3
5)User interface, like Serial, LCD, CAN.

It is #3 and #4 that effect this thread, IMHO.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> I'm still confused, are we measuring the current through a known resistance to get voltage?
> What am I missing here?
> 
> Ideally i want to scale my AC voltage (say +-400V) so that -400VAC gives a 0V reading to my MCU, 0VAC gives a 1.8V reading to my MCU, and 400VAC gives a 3.8V reading. Ideally I also want this isolated. I say AC voltage to differentiate from the ADC voltage, but it really needs to just be an instantaneous snapshot of voltage between the phase and DC-.
> ...


Most hall effect have a auxiliary Flux enhancer, like a coil or Ferrite Core. The actual hall effect is an IC that converts Flux density and angle to a DC voltage. hence you have Isolation. Hall devices therefore work on AC or DC. For AC the DC output will fluctuate mirroring the AC it is exposed to.
if you put the hall effect in series with the wire (usually though the center of a Ferrite core) then it is a Current sensor. If you put a hall effect in parallel (across the voltage) then you can use a resister to minimize the current, and since you know the Divider characteristics you can say that for a given voltage, the hall effect output will have a certain voltage.
when putting a hall effect sensor across a voltage, we don't need a lot of current but a lot of flux, this is accomplished with a coil that has high resistance but a lot of windings. The Actual Hall effect device is placed in this flux field. it is not connected to the Voltage that is being measured.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> JR,
> Thanks for your response.
> I was looking at using 2 80mhz MCU demo boards. Alot of the data can be sent in parallel using a few ports each and would just be the output of the hysteresis controllers (0-4), flux sector (0-5) and angle (if you are familiar with DTC operation). Other information for debugging or advanced features can be sent in serial.


your already started with your design so this is more of how you arrived at you design.
You stated you did a processor without DSP, is that the reason you need 2 mcu.
I have been using a 80 Mhz DSP 56F803 for years and it handles the job of drive management.


> Because the control is SVM, this is perfect for two processors (or dual core), with the first CPU computing the preview vector, and the second implementing the smaller vectors. Infact i originally started design using the 8core propeller MCU, but hated the language so scrapped that.
> 
> The DSPic is definitely the path I will go down once I have proven the code, and finalised PCB design. If i could find a cheap DSPic 70MIPS demo board then maybe i would use that straight up.


The name infers a DSP, are you deciding a DSP is necessary?
I have found that I needed to optimize the machine code macros created by the Cross compiler, so my decision was based on clock cycles for instructions.
Most chips range from $8-$20 in single item orders.
Most dev boards Range from $10-$40, manufacture proto boards being the most inexpensive and way below the Cost of production.


> Not gonna be selling these, don't own the right to DTC patents. Maybe I would give the design upon completion of a electrical theory and safety test lol. Don't want anyone killing themselves over a schematic i've given them.
> 
> If there's interest, might create a youtube series on the build. Have already done the model in simulink (started with blocks then replaced with code), Solidworks design of the finished product, CFD on the water-cooled heatsink, and eagle PCB surface mount design of the finished board if it all works as expected.


have you thought about adding the modeling into the actual MCU as a module.
there are Graphic LCD(3.5 inch) that are inexpensive ($30) that can be driven from a MCU that has enough ports or using Ic2. or you can use a graphic library to generate the RGB an sync to output to a computer monitor.
if you find that module slows up the drive management you can off load it to a second mcu.
The stm32f4 discovery board is about $20.


----------



## stickytechnology (Sep 19, 2010)

Hi,

I have been playing around with DTC for a while now. I started off with an industrial VFD for the inverter stage, and am designing my own control. I'm not ready to share the design, but I can share some lessons. I'm using the STM32F103 family of microcontroller. The biggest challenge to DTC seems that the phase currents need to be measured as close to simultaneously as possible, which is where the STM32F103 shines. It has dual 12-bit ADCs with DMA.

As far as I can tell, the DTC algorithm does not require measuring phase voltages-- only the DC link voltage and two phase currents. The third phase current can also be measured for fault detection. The phase voltages are always either the link voltage or zero anyway (in a Delta configuration) -- you have only eight possible states for your inverter and all three phases are either connected to one rail or the other, except for the brief switching transitions. 

Patent-wise, the DTC patents have been expired for some time, so I don't see any barrier to commercialization, other than there's no money in selling inverters to hobbyists. It's fun to hack away on, though.

As far as progress, I have my system running in six-step mode, which means that it turns a motor, but I need to do more work on the analog side of my current sensing block.


----------



## PStechPaul (May 1, 2012)

There are some application notes by Microchip which may be helpful:
http://ww1.microchip.com/downloads/en/AppNotes/01162A.pdf (FOC of ACIM)
http://ww1.microchip.com/downloads/en/AppNotes/01083a.pdf (Back EMF)

I think it may not be necessary to isolate the voltage sensing circuitry, especially for the DC bus voltage. For that, a single-ended voltage divider should be sufficient, as long as the reference ground is at the same potential as the motor drive and DC link common. Mostly all that is needed is the average DC level to assure that it is sufficient to provide the peak voltage for the motor. Ripple and voltage sag are important, but should not be an issue in most cases where the bus capacitors are sufficient and drive current is within specification.

For current measurement, a single sensing resistor on the common of the bridge should be able to detect peak currents and zero crossings. But it might be important to monitor individual phase currents. Also, perhaps individual phase voltages need to be monitored, which may require isolated Hall-effect modules. 

I am only somewhat familiar with the 8 bit motor control PIC:
http://ww1.microchip.com/downloads/en/DeviceDoc/39616d.pdf
It has a motion feedback module and a power control module, and the information on those may help.

Here is a user's guide with schematic of Microchip's high voltage motor control module. It shows a Hall-effect device to measure bus current, but it seems that the currents in each leg of the bridge use shunt resistors and differential amplifiers. There are single-ended voltage dividers with 182k resistors to sense the three drive voltages. This module would be a good place to start. It costs $600 but could probably be prototyped for much less, especially if it needs changes for a specific application. Otherwise it may be a good investment, since it has already been optimized and perfected, and all components and circuitry, and source code, are well documented. 

Hope this helps.


----------



## bjfreeman (Dec 7, 2011)

the Board I have uses an Isolated Power source for the AtoD in the micro. The ground is floating to eliminate ground looping and noise picked up but referencing a common ground.

though you can cram the code into 8bit, to do any floating point math you need 16 bits, so there are many cpu cycles to so any serious number crunching, compare to a 16 or 32 bit data bus and registers.

if the number crunching is not time sensitive then 8bits works.
A Digital Signal processor (DSP) as well as a Floating Point Unit (FPU) is almost required to do the math, filtering, for DTC an SVM in realtime.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> If you put a hall effect in parallel (across the voltage) then you can use a resister to minimize the current, and since you know the Divider characteristics you can say that for a given voltage, the hall effect output will have a certain voltage.


Thanks, it makes sense now  Thanks for clearing that up



bjfreeman said:


> The name infers a DSP, are you deciding a DSP is necessary?


I thought with some smart coding i could get around requiring a DSP, however this was not ideal and the final version would have used a 32bit DSP with FPU. I was planning on using 2x 32bit 80mhz (100MIPS), but since you put me onto the cheap STM32F4 168Mhz w FPU, demo board - I think this is what i'll use upfront. I was amazed it was only $20, things have changed since i last looked at DSP demo boards a few years ago.


----------



## Stiive (Nov 22, 2008)

Hey Sticky,
Great to hear someone else is doing DTC!



stickytechnology said:


> Hi,
> I have been playing around with DTC for a while now. I started off with an industrial VFD for the inverter stage, and am designing my own control. I'm not ready to share the design, but I can share some lessons. I'm using the STM32F103 family of microcontroller. The biggest challenge to DTC seems that the phase currents need to be measured as close to simultaneously as possible, which is where the STM32F103 shines. It has dual 12-bit ADCs with DMA.


Yeh, I am now planning to use the STM32F4, it has 3 12bit 2.4MSPS ADCs.



stickytechnology said:


> As far as I can tell, the DTC algorithm does not require measuring phase voltages-- only the DC link voltage and two phase currents. The third phase current can also be measured for fault detection. The phase voltages are always either the link voltage or zero anyway (in a Delta configuration) -- you have only eight possible states for your inverter and all three phases are either connected to one rail or the other, except for the brief switching transitions.


This is true. The calculations can be done using the switching states and Vdc, however I have noticed on high powered drives they measure the phase voltage independently. This probably has something to do with the inductance of the motor. If I can't get an adequate voltage sensor for the phases then I will resort back to the switch state code and DC link voltage. I still require an isolated voltage sensor design though. I am waiting on hearing from a DTC expert for further reasoning.



stickytechnology said:


> Patent-wise, the DTC patents have been expired for some time, so I don't see any barrier to commercialization, other than there's no money in selling inverters to hobbyists. It's fun to hack away on, though.


Ooh, interesting thought  But I'm not doing this to make money



stickytechnology said:


> As far as progress, I have my system running in six-step mode, which means that it turns a motor, but I need to do more work on the analog side of my current sensing block.


Have you made anything public yet? I'd be keen to see your setup. Whats wrong with your current sensing block?


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I think it may not be necessary to isolate the voltage sensing circuitry


Perhaps not. As long as I keep an isolated 15-20V power source to power the opto gate drivers.
I want to power my MCU from a LV system (ie battery), yet keep that voltage isolated from the HV so i can also use it to run the gate drivers.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> the Board I have uses an Isolated Power source for the AtoD in the micro. The ground is floating to eliminate ground looping and noise picked up but referencing a common ground.
> 
> though you can cram the code into 8bit, to do any floating point math you need 16 bits, so there are many cpu cycles to so any serious number crunching, compare to a 16 or 32 bit data bus and registers.
> 
> ...


So since in planning on now using the STM32F4, i guess this also has isolated ADC. Does this mean if i use a battery to power the micro, using the ADC to measure say the DC link voltage unisolated, the DC bus would remain isolated from the battery?


----------



## stickytechnology (Sep 19, 2010)

I'm not very active on this because of other time commitments, but I put up a summary some time ago at http://stickytechnology.com/ There is a link to my car build blog, and at the end there is a link to a code repository.

I started off on the 8-bit AVR platform just to do a proof of concept and to get an idea of how computationally heavy the DTC algorithm is. I have since graduated to the STM32, but haven't gotten around to updating the site.

Regarding isolation, you really do want it. Logic ground should have no connection to the DC link for safety and noise reasons. In my inverter (a TECO MA7200, by the way), the link voltage sensing uses an auxiliary winding on the isolated flyback converter that powers the gate drivers and the control electronics. If you turn the diode around on a flyback secondary, you get a voltage that is proportional to the primary voltage, regardless of duty cycle.

My analog problems relate to having bipolar (+/- 15V) outputs from the current transducers and getting that to the 0--3.3V range the ADC needs. Originally I got fancy and designed an active rectifier and attenuator circuit, but offset and drift were terrible. I have designed the simple solution of a resistor network now, but haven't had time to try it out in hardware.


----------



## subcooledheatpump (Mar 5, 2012)

Hi Guys, I've been reading through the thread and it's very interesting to me

As some on here may know, I have a converted van that uses a modified industrial VFD. I would like to get FOC or DTC eventually though. 

I have a question that is probably really stupid, but here goes. 

Induction motors make peak torque usually at low frequencies. So a FOC or DTC drive not only provides variable torque with respect to a variable input, but also variable frequency at the same time, with respect to how much torque is being asked of it?

If a fixed speed refrence is set, how does the drive calculate what frequency should be applied when a torque command is first given?


----------



## PStechPaul (May 1, 2012)

I'll try to give some simple ways to describe how to achieve a specific torque and a target speed. There is an older app note that describes ways to do it: http://ww1.microchip.com/downloads/en/AppNotes/00900a.pdf

This assumes a speed feedback of some kind, which may be done sensorless by reading back EMF. If you know the motor's slip, you can use that to determine the peak torque, and probably the torque can be adjusted from zero to maximum by reading the slip as applied frequency-motor speed. Thus you would apply a frequency based on the slip for the desired torque, and then ramp up until the actual speed is what is desired.

Also, an ACIM generally has a fairly constant torque at all speeds up to maximum, if you use a constant V/F. And torque is at least roughly proportional to current, while speed is proportional to voltage, so these parameters can be used as well. I'm using standard controllers and motors, and they have programmable parameters you can tweak for any conceivable type of motor. 

Maybe you can get better performance or higher efficiency by using more sophisticated control, but I wonder just how much improvement you can get, at the cost of increased complexity and subsequent higher risk of failure or at least increased testing. IMHO the greatest increase in efficiency and HP to weight ratio can be had by overclocking and rewiring star to delta. The biggest problem with EVs continued to be battery technology, with tradeoffs of cost, size, weight, longevity, recyclability, and safety.


----------



## Stiive (Nov 22, 2008)

subcooledheatpump said:


> If a fixed speed refrence is set, how does the drive calculate what frequency should be applied when a torque command is first given?


If you run the motor in speed reference mode, the torque is generally controlled via a PID loop (although any feedback loop will do). Basically the PID will keep adjusting the torque output of the motor untill the desired speed is reached.

If you were running a sort of primitive slip control, you would need to work out the slip that would give you the required torque, then convert that to an electrical frequency which you would apply to the stator. To then get the voltage you need to apply for this freq, you would look at your V/Hz characteristics of the motor.


----------



## bjfreeman (Dec 7, 2011)

for constant speed motors, this is all good.
However in an EV an HEV paradigm, you have a closed loop so you know the Slip. You can use the slip for Regen. the Input from the TCM through the CAN gives you the Target Frequency which is variable.
A lot of the algorithm is checking if the target Frequency is met and how much slip there is. The the slip goes out of bounds then a fault it created, which then analysis if it is a real fault or go into regen. 
This has to happen very fast since if a real fault the system has to decide if to shut down or have limited ability to save the Drive system an motor.
I keep hear about complexity, yet todays cars are flyby wire, an have more than one micro.
the controller just replaces the ICE complexity.
Since I am an HEV, Batteries are not the main concern since they are used till the Power source comes up to speed.
Though many Power sources are an ICE with a generator or A gearing system to parallel the EV system, I keep my eye on Hydrogen Fuel Cells, which are more costly than Batteries.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> I keep hear about complexity, yet todays cars are flyby wire, an have more than one micro.
> the controller just replaces the ICE complexity.


Luckily in DTC you don't have to do frequency control. Heck, i prob wont even have a speed loop. Just plug in the torque I want and let the DTC do its thing

I don't think DTC is particularly complicated at all, far less complicated than FOC code wise, it just needs a super quick sample time.


----------



## Stiive (Nov 22, 2008)

Hey mate, thanks for the link. 
I've been meaning to ask what flux control your using? I've tried a few and still perfecting it. Basing mine on MTPA, but with some other code to keep ripple as low as possible.

Also, plugged the flux estimation into my SimPowerSystems simulation and plotted the estimation vs real flux in the motor - it's far less accurate, but can work okay i guess.

If your interested, I can post some pics of the results.



stickytechnology said:


> Regarding isolation, you really do want it. Logic ground should have no connection to the DC link for safety and noise reasons. In my inverter (a TECO MA7200, by the way), the link voltage sensing uses an auxiliary winding on the isolated flyback converter that powers the gate drivers and the control electronics. If you turn the diode around on a flyback secondary, you get a voltage that is proportional to the primary voltage, regardless of duty cycle.


So if im understanding correctly, it has a flyback converter connected to the DC bus with 2 secondaries. The first secondary powers the gate drivers and MCU (which in-turn controls the modulation of the primary). The aux secondary has a ratio to scale the DC bus voltage down to voltages appropriate for the MCU's ADC?
If this is correct, how accurate is that? So you have to trust the turns ratio + hysteresis/eddy current losses, and the MCU provided modulation index for the primary... 
I guess you would have the first primary output voltage larger than what is required and then use a switch-mode to get it to the right voltage so you don't have to change the modulation of the flyback for voltage compensation.




stickytechnology said:


> My analog problems relate to having bipolar (+/- 15V) outputs from the current transducers and getting that to the 0--3.3V range the ADC needs. Originally I got fancy and designed an active rectifier and attenuator circuit, but offset and drift were terrible. I have designed the simple solution of a resistor network now, but haven't had time to try it out in hardware.


Why not get a new current sensor that outputs 0-3.3V?


----------



## bjfreeman (Dec 7, 2011)

lol you posted at the same time, so it looked like I was responding to your post.
yes fast sample time, and I have both FOC and DTC running checking each other as well as code to deal with faults of the hardware.


----------



## PStechPaul (May 1, 2012)

Maybe there's a simpler way. ACIMs can withstand application of full voltage at target frequency for several seconds as they come up to speed, and simple current measurement should be able to differentiate between locked rotor current and normal start-up current. Being an inductive device, as long as you keep the V/F ratio, the maximum current should be no more than 3-4 times rated, and it will not cause damage if a motor overload device trips after several seconds. Since an EV has a wide and constantly changing range of loads and speed requirements, it may be enough to just monitor current and adjust the frequency and voltage to stay within the current of breakaway torque, and shut down if locked rotor torque current exists for too long. But the drive frequency could be just throttled back until the current drops to a safe level.

To protect the IGBTs, the bottom leg current sensors of each section can detect an extreme high current using a comparator which can instantly "short-cycle" the PWM, using an external interrupt. The PIC18F4420 (and the three-phase control PIC18F4431) have enhanced PWM auto-shutdown modes that can do just that. In fact, this may actually be able to detect saturation of the motor and automatically reduce the PWM drive voltage at a given frequency.

Also, I found a pretty good overview of VF drives from AB:
http://www.ab.com/support/abdrives/documentation/fb/1024.pdf


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> yes fast sample time, and I have both FOC and DTC running checking each other as well as code to deal with faults of the hardware.


Awesome, didn't realise you had DTC working. Have you done a comparison of performance between running in DTC and running in FOC?
Not sure what you mean by having them 'checking each other'.

Do you use the DC voltage or phase voltages to work out Vd and Vq? 
I'm having a play around with just using a DC voltage sensor, however the error it causes in the flux calcs sends my flux controller haywire! 
Its starting to give me a perfectly sinusoidal torque ripple for some reason lol


----------



## aeroscott (Jan 5, 2008)

Would a NTSC vectorscope ,520 tektronix ,any good for testing these drives ? they were used for color tv work . Great work guys I'm learning a lot . thanks


----------



## bjfreeman (Dec 7, 2011)

The model of the Power Stage I use is:
1) half bridge drivers to the motor.
2) current an voltage sensors on the DC Bus supplying power to the Drivers.
3)current an voltage sensor at the Motor 3 phases.
4) Temp sensors on the Brioge drivers
5) temp sensors on the motor
6) vibration sensor on the motor.
yes you don't need all three phases for the calculations.
Remember we are modeling a Power Stage of a moving vehicle that can cause a lot of damage if things to bad.
One can "economize" but this is one area one should not.

Both interrupts, and timers are used to monitor the sensors and control this stage. more on this in discussion on the Drive management.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Awesome, didn't realise you had DTC working. Have you done a comparison of performance between running in DTC and running in FOC?
> Not sure what you mean by having them 'checking each other'.
> 
> Do you use the DC voltage or phase voltages to work out Vd and Vq?


both, I will get into that later.


> I'm having a play around with just using a DC voltage sensor, however the error it causes in the flux calcs sends my flux controller haywire!
> Its starting to give me a perfectly sinusoidal torque ripple for some reason lol


Sensors is one variable, however the math package you use an how you use it also effects outcomes.
http://www.youtube.com/watch?v=mf8oOG0woeI
I don't use mathlab or simulators, except as roughing out Ideas.
I prefer to use the Actual device to get results.
as a starter I use low powered IGBT's and A low powered 3phase motor to get famllar with the sensors. and get them calibrated with an external source, like a Scope, with a current probe.
Then I use black box with fixed inputs to test the software. so I plug calibrated voltage sources and digital generators into the inputs.
The reason is the math package and timing all effect the outcome.
Typically the control algorithm has to be performed with 10 - 30 microseconds or shorter intervals.
The current measuring devices have to be high quality ones without noise because spikes in the measured signals easily cause erroneous control actions. Further complication is that no low-pass filtering can be used to remove noise because filtering causes delays in the resulting actual values that ruins the hysteresis control.
The stator voltage measurements should have as low offset error as possible in order to keep the flux estimation error down. For this reason the stator voltages are usually estimated from the measured DC intermediate circuit voltage and the igbt control signals.


----------



## MAVA (Apr 13, 2012)

Gentlemen,

I've been looking at the EV conversions where the "nuts and bolts" are described(where the DIY controllers and chargers are described). A thing to note is the model airplane crowd is regularly doing electric 10kW power systems, and some manufactures cannot keep-up with the requirements of the hobby, so some individuals are DIYing motors and controllers, Consequently, the motors used are permanent magnet type, but one thread on DIY sensorless brushless and some sensored brushless controllers is going on 2500 posts since 2004, and still going strong! The thread has lots and lots of code, schematics, and graphs. Can help you guys. Several poster's Takao Shimizu, KreAture, Quax and others have great posts, and believe some of the code and data on the thread may help.

http://www.rcgroups.com/forums/showthread.php?t=200567

Martin


----------



## Stiive (Nov 22, 2008)

Stiive said:


> I'm having a play around with just using a DC voltage sensor, however the error it causes in the flux calcs sends my flux controller haywire!
> Its starting to give me a perfectly sinusoidal torque ripple for some reason lol


Worked out whats happening. Its not the flux controller thats causing the problems, its the torque hysteresis controller. The error in Vd and Vq cause an error in the flux estimation that's sinusoidal for some reason. The magnitude of the ripple is still great, and following the error between the reference and torque est, but the torque est just happens to be sinusoidal.

It's nothing major though, a reference of 200Nm is returning a sinusoidal torque response between 190 and 210Nm, with a ripple magnitude of < +-3Nm


----------



## Stiive (Nov 22, 2008)

MAVA said:


> Gentlemen,
> 
> I've been looking at the EV conversions where the "nuts and bolts" are described(where the DIY controllers and chargers are described). A thing to note is the model airplane crowd is regularly doing electric 10kW power systems, and some manufactures cannot keep-up with the requirements of the hobby, so some individuals are DIYing motors and controllers, Consequently, the motors used are permanent magnet type, but one thread on DIY sensorless brushless and some sensored brushless controllers is going on 2500 posts since 2004, and still going strong! The thread has lots and lots of code, schematics, and graphs. Can help you guys. Several poster's Takao Shimizu, KreAture, Quax and others have great posts, and believe some of the code and data on the thread may help.
> 
> ...


Thanks for the link Martin, I'm sure it'll prove an interesting read.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> both, I will get into that later.


When? 



bjfreeman said:


> I don't use mathlab or simulators, except as roughing out Ideas.
> I prefer to use the Actual device to get results.


Simulators can be great for testing code. I didnt know anything about DTC a few months ago, I would have let the smoke out many times if i couldnt have simulated my ideas first




bjfreeman said:


> as a starter I use low powered IGBT's and A low powered 3phase motor to get famllar with the sensors. and get them calibrated with an external source, like a Scope, with a current probe.


Yeh, i'm getting some small fairchild IGBTs (600V 75A) to test with first. Im not risking my 600A IGBTs first go. Trying to get gate drivers that will drive both IGBTs so i can just replace the IGBTs when low power testing is done.



bjfreeman said:


> Typically the control algorithm has to be performed with 10 - 30 microseconds or shorter intervals.


I'm hoping to run at 5us, though with DSVM I only need to compute the vectors every 3rd sample.



bjfreeman said:


> The stator voltage measurements should have as low offset error as possible in order to keep the flux estimation error down. For this reason the stator voltages are usually estimated from the measured DC intermediate circuit voltage and the igbt control signals.


How does your stator voltage sensing setup fare?


----------



## Stiive (Nov 22, 2008)

Stiive said:


> Worked out whats happening. Its not the flux controller thats causing the problems, its the torque hysteresis controller. The error in Vd and Vq cause an error in the flux estimation that's sinusoidal for some reason. The magnitude of the ripple is still great, and following the error between the reference and torque est, but the torque est just happens to be sinusoidal.
> 
> It's nothing major though, a reference of 200Nm is returning a sinusoidal torque response between 190 and 210Nm, with a ripple magnitude of < +-3Nm


Here are some pics, sorry for the crap quality - only allowed to be <90kb!

Vd and Vq calculated from Vdc - You can see the error in the estimated flux too (est=yellow vs real=purple second graph from top)








Vd and Vq calculated from phase voltages. Error in estimated flux (and torque) is reduced significantly









As i said, i'm still perfecting the flux controller, hopefully I can get the ripple down lower when I smooth out the flux reference command - but doesn't take away from the Vd Vq error results


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Hey mate, thanks for the link.
> I've been meaning to ask what flux control your using? I've tried a few and still perfecting it. Basing mine on MTPA, but with some other code to keep ripple as low as possible.


I'm not familiar with MTPA. I saw a paper, but didn't really wade through. I haven't gotten to the part where I play around with flux magnitude yet. I figured I won't lose too much by just having a "running" mode where the torque request is above some minimum and the flux magnitude is set to the nominal V/Hz value, and a "coasting" mode where the flux magnitude is zero.




Stiive said:


> Also, plugged the flux estimation into my SimPowerSystems simulation and plotted the estimation vs real flux in the motor - it's far less accurate, but can work okay i guess.
> 
> If your interested, I can post some pics of the results.


That'd be cool



Stiive said:


> So if im understanding correctly, it has a flyback converter connected to the DC bus with 2 secondaries. The first secondary powers the gate drivers and MCU (which in-turn controls the modulation of the primary). The aux secondary has a ratio to scale the DC bus voltage down to voltages appropriate for the MCU's ADC?
> If this is correct, how accurate is that? So you have to trust the turns ratio + hysteresis/eddy current losses, and the MCU provided modulation index for the primary...
> I guess you would have the first primary output voltage larger than what is required and then use a switch-mode to get it to the right voltage so you don't have to change the modulation of the flyback for voltage compensation.


There's actually 10 secondaries on the flyback. One for each of the gate drives, 2 for the supplies to the current sensors, one 5v rail for the MCU, and the voltage sense winding. It's actually very precise- it's only the turns ratio that matters in a transformer, and with the diode flipped around on a secondary, that's what it really is-- it's not a flyback winding anymore. There's the diode drop to account for, but that's it. The modulation is done on the primary side in the normal way, with opto feedback, so the MCU doesn't control the flyback. The rails regulate to within a volt, but I do downregulate the 5v to 3.3 for the MCU. It's the problem with reverse engineering an industrial VFD-- some stuff suits, and other stuff doesn't

I'm attaching a picture of the flyback/gate driver board from my drive. The TO-220 part with the heatsink in the lower left is the flyback switch. The right half of the board are the gate drives, and the left half is some precharge stuff I'm not using.



Stiive said:


> Why not get a new current sensor that outputs 0-3.3V?


Stubbornness


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> When?


the variable for 3 phases and 3 voltages from the motor, when the Conversion is done, are filled with dma, the address vector to the routine is executed. this is where which routine is run as the primary is done. The secondary address vector is called by which ever the primary routine is. one module is the DTC and the other is FOC, each fill variables that the SVM module uses to drive the Powerstage.


> Simulators can be great for testing code. I didnt know anything about DTC a few months ago, I would have let the smoke out many times if i couldnt have simulated my ideas first


Yes that is what I was meaning, but the actual math and results should be done by the devices math and hardware.


> Yeh, i'm getting some small fairchild IGBTs (600V 75A) to test with first. Im not risking my 600A IGBTs first go. Trying to get gate drivers that will drive both IGBTs so i can just replace the IGBTs when low power testing is done.


be interested in your results, I was unable to do use the same IGBT driver. Maybe this time if I give it time to perk in the grey matter.


> I'm hoping to run at 5us, though with DSVM I only need to compute the vectors every 3rd sample.
> 
> How does your stator voltage sensing setup fare?


The Ratio metric Halls work well. they are current driven on the output so noise does not effect them. They are sensitive enough not to need additional flux enhancement. They are actually measuring the flux density and that is interpreted into voltage. They are also used for phase in relationship to the other two.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> That'd be cool


See above for the differences between phase voltage sensing and approximation using Vdc




stickytechnology said:


> It's actually very precise- it's only the turns ratio that matters in a transformer, and with the diode flipped around on a secondary, that's what it really is-- it's not a flyback winding anymore. There's the diode drop to account for, but that's it.
> The modulation is done on the primary side in the normal way, with opto feedback, so the MCU doesn't control the flyback. The rails regulate to within a volt, but I do downregulate the 5v to 3.3 for the MCU.


Okay, I understand now. I thought changing the modulation for the 5V regulation would also effect the measurement of the DC voltage. 
But what your saying is, for instance, a PWM signal on the primary of a transformer will result in the same PWM signal in the secondary at a scaled peak voltage regardless of the duty cycle. I guess I assumed it would have been smoothed out to just output the RMS scaled, probably due to something to do with the turns acting as inductor coils.
I guess you then have to be very careful not to have any capacitance on the secondary in this DC-DC conversion because the average voltage delivered will be much lower (dependent on duty cycle). I guess it also means you can only sample the DC output after a rising edge, so you'd hope that duty cycle is pretty high.



stickytechnology said:


> I'm attaching a picture of the flyback/gate driver board from my drive. The TO-220 part with the heatsink in the lower left is the flyback switch. The right half of the board are the gate drives, and the left half is some precharge stuff I'm not using.


Wouldn't happen to have the model number handy, would you? I cant seem to find any flyback capable of ~400V or with that many secondaries.


----------



## PStechPaul (May 1, 2012)

I think I see why the DC output is proportional to the input even at various duty cycles. The rectangular waveform will still have the same peak value, and with a diode and capacitor, and a light load, it will maintain the peak value. But then it would float the peak value.

I'm not sure why this is necessary to measure the bus voltage. It does provide isolation, but I think the negative rail should be at earth (or vehicle chassis) ground potential. There should be separate grounds for power and analog and digital signals, of course, but they still should be connected at some point, perhaps with a low value resistor. This is actually a safer condition than having complete isolation, which can be a problem with delta-connected supplies. Without a neutral reference, and bleeder resistors to establish a reference point, the capacitance of windings can float to a very high potential, possibly enough to break down insulation or arc over an air gap. 

It may be worthwhile to use a differential amplifier to read power system voltages and currents, but this only requires an op-amp and four resistors. 500k resistors will work fine for 320 and 640 VDC rails, and draw less than 2 mA. For optimum safety, install the resistors close to the source, so most of the wiring will be current-limited to a safe level. If high frequency waveform accuracy is needed, trimmer capacitors can be added as on a scope probe.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I think I see why the DC output is proportional to the input even at various duty cycles. The rectangular waveform will still have the same peak value, and with a diode and capacitor, and a light load, it will maintain the peak value. But then it would float the peak value.


Yeh but I don't want to maintain the peak value if i'm using it to sense to DC voltage. I want it to quickly respond to any changes in voltage on the DC bus



PStechPaul said:


> It may be worthwhile to use a differential amplifier to read power system voltages and currents, but this only requires an op-amp and four resistors. 500k resistors will work fine for 320 and 640 VDC rails, and draw less than 2 mA. For optimum safety, install the resistors close to the source, so most of the wiring will be current-limited to a safe level. If high frequency waveform accuracy is needed, trimmer capacitors can be added as on a scope probe.


This was my original design, but then i have the problem of isolation. Perhaps i could use a flyback to power an analog opto such as the HCNR200/1, but then I might as well use the flyback for the voltage sensing, as long as its accurate enough.

And then there's bjfreemans suggestion of using hall effect sensors.

I have a few options now, but am still trying to work out if i can get the code to work well enough for my project to just sense the DC bus voltage as this may alter my hardware choice. For instance just sensing the DC bus requires 1 sensor rather than 3 and therefore can use a more expensive solution. Its also sensing DC rather than AC which also makes life easier.


----------



## PStechPaul (May 1, 2012)

I still have doubts about the need for isolation. Nothing is ever totally isolated. There will still be capacitance, leakage, insulation breakdown, and EMR. But as long as you have valid reasons for it, (or even not), it is merely a design choice and not a problem if it works as you wish.

But I do not know how measurement of the DC link bus can provide accurate measurement of motor phase voltage. The only reference I could find is the following, which describes a variable link voltage which can be used for speed control of a BLDC:
http://www.freescale.com/files/microcontrollers/doc/ref_manual/DRM078.pdf

I realize that the voltage at the motor will be equal to the bus voltage anytime the upper IGBT is turned on, except for the saturation voltage of the IGBT, but it is also important to measure the voltage when it is unloaded during PWM cycles. Maybe I'm missing something, but I think it may be necessary to measure the actual voltage on each motor lead. It can be measured WRT ground and then a vector calculation can provide the phase-phase voltage. But the DC link voltage should be a solid as possible, and the value of measuring it, IMHO, is to determine degradation of link capacitors or high current surges that may cause glitches and ripple.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> But I do not know how measurement of the DC link bus can provide accurate measurement of motor phase voltage.


It's not all that accurate, but its fairly good. You can see from the result i posted the calculation error in estimating the flux/torque from Vq and Vd.


Sometimes due to back emf you get a voltage on one of the phases even when the switch is off, and this causes discrepancy between the two formulae, leading to error propagation in the following estimators.



PStechPaul said:


> Maybe I'm missing something, but I think it may be necessary to measure the actual voltage on each motor lead.


This is the ideal solution, and still the method i want to pursue. It obviously presents its own problems though in terms of measuring all 3 voltages as instantaneously as possible, and requires more time than calculations from 1 voltage measurement and known switch states.


----------



## bjfreeman (Dec 7, 2011)

Just so we are on the same page, the way the PWM generates a sinusoidal wave is by varying he PWM during a cycle.
During the Positive swing the Top of the Half bridge is modulated. During the negative swing the bottom half of the bridge is modulated.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> Just so we are on the same page, the way the PWM generates a sinusoidal wave is by varying he PWM during a cycle.
> During the Positive swing the Top of the Half bridge is modulated. During the negative swing the bottom half of the bridge is modulated.


Who's on what page? lol


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> I still have doubts about the need for isolation. Nothing is ever totally isolated. There will still be capacitance, leakage, insulation breakdown, and EMR. But as long as you have valid reasons for it, (or even not), it is merely a design choice and not a problem if it works as you wish.


I see it as a safety feature- it requires a two fault condition to generate a chassis short or a shock hazard. You have lots of parasitic capacitance everywhere keeping the potentials from running away and arcing over.



PStechPaul said:


> But I do not know how measurement of the DC link bus can provide accurate measurement of motor phase voltage. The only reference I could find is the following, which describes a variable link voltage which can be used for speed control of a BLDC:
> http://www.freescale.com/files/microcontrollers/doc/ref_manual/DRM078.pdf
> 
> I realize that the voltage at the motor will be equal to the bus voltage anytime the upper IGBT is turned on, except for the saturation voltage of the IGBT, but it is also important to measure the voltage when it is unloaded during PWM cycles. Maybe I'm missing something, but I think it may be necessary to measure the actual voltage on each motor lead. It can be measured WRT ground and then a vector calculation can provide the phase-phase voltage. But the DC link voltage should be a solid as possible, and the value of measuring it, IMHO, is to determine degradation of link capacitors or high current surges that may cause glitches and ripple.


I think there's more than one way to skin the cat, but in the DTC algorithm, the phases are always connected to one rail or the other, thus you're always applying either Vbus or 0 volts across the windings. See my animation at http://stickytechnology.com/ for a Delta-connected example.

DC link voltage can vary quite a bit- even the best battery sags under load. The flyback method acts like a peak detector, like you said, so it's the RC time constant there that determines its responsiveness.


----------



## stickytechnology (Sep 19, 2010)

bjfreeman said:


> Just so we are on the same page, the way the PWM generates a sinusoidal wave is by varying he PWM during a cycle.
> During the Positive swing the Top of the Half bridge is modulated. During the negative swing the bottom half of the bridge is modulated.


Not quite. Each winding has two ends, so during one half of the cycle you switch one end between +VBAT and -VBAT with an appropriate duty cycle, and the other end with a complimentary duty cycle. During the other half of the cycle, you do the opposite. Both ends are always connected, except during the very short periods where both switches are open to prevent shoot through.


----------



## PStechPaul (May 1, 2012)

stickytechnology said:


> Not quite. Each winding has two ends, so during one half of the cycle you switch one end between +VBAT and -VBAT with an appropriate duty cycle, and the other end with a complimentary duty cycle. During the other half of the cycle, you do the opposite. Both ends are always connected, except during the very short periods where both switches are open to prevent shoot through.


That's what I thought. So a zero-voltage condition is actually a 50% duty cycle on all three bridges? So it seems from the following:
http://www.industrial-electronics.c...tion-Waveforms-Variable-Frequency-Drives.html


----------



## Stiive (Nov 22, 2008)

I'm getting confused... Why are we discussing PWM?

Are we trying to prove/disprove that the voltage in the phase is either Vdc or 0? 
If so, I say this is incorrect and is only an approximation. Remember the induction motor has inductance, obviously. When there's a change to the current in an inductor, a voltage is induced to oppose this change. 

For example: When the current is decreased (i.e the gate turns off or sine has reached peak), the voltage will build up on the positive side to oppose this change to reduce current. This will only be bled by the FWD if the voltage build up becomes higher than the DC bus potential (voltage is proportional to rate of change of current), or the gate is opened again.

Please correct me if I'm wrong


----------



## bjfreeman (Dec 7, 2011)

stickytechnology said:


> Not quite. Each winding has two ends, so during one half of the cycle you switch one end between +VBAT and -VBAT with an appropriate duty cycle, and the other end with a complimentary duty cycle. During the other half of the cycle, you do the opposite. Both ends are always connected, except during the very short periods where both switches are open to prevent shoot through.


In a delta configuration you are correct.
Mine is a Y in which case the frame is a common.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> This is the ideal solution, and still the method i want to pursue. It obviously presents its own problems though in terms of measuring all 3 voltages as instantaneously as possible, and requires more time than calculations from 1 voltage measurement and known switch states.


The STM32 has some different configurations where all channels can be done in one clock cycle.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> I'm getting confused... Why are we discussing PWM?
> 
> Are we trying to prove/disprove that the voltage in the phase is either Vdc or 0?
> If so, I say this is incorrect and is only an approximation. Remember the induction motor has inductance, obviously. When there's a change to the current in an inductor, a voltage is induced to oppose this change.
> ...


two reasons:
1) clarify the difference between Delta an Y motor configurations.
2) Showing that the PWM varies within a Half cycle, so the calculations not only have to take in to account the relationship between the Motor Rotor and the phase of the AC but the PWM that is creating it. That only control we have is adjusting when the PWM is generated and the Pulse width.
Yes there is a Reverse EMF as you describe.








Delta where each phase is a curcuit.








and the Y where the the common is the frame.


----------



## PStechPaul (May 1, 2012)

This discussion has been very helpful to my understanding of the operation of the VFD and the requirements for measurement of motor parameters. I can see the point that the motor voltage will be essentially the same as the DC link voltage because it is always either at link+ or link-, and we know when that is because the drive does the commutation. As for the difference between delta and star connection, I think it does not really matter except for the actual driving voltage differing by 2*sin(30) or sqrt(3), about 1.73, or 480/277. 

However, I think the current measurement must be adjusted for the phase angle to get the current for the desired pole of the motor. The torque is proportional to the current.

But perhaps there is an even easier way to determine torque. The bus voltage is, or should be, fairly constant and flat over a fairly long period of time so that its average value may be used, and this helps reduce the effect of noise and increases the accuracy of the reading. So we can use a simple voltage divider and analog filter and a low-end ADC.

The actual power consumed by the motor is equal to the product of the DC voltage and current, and IIRC the sum of the RMS currents in a three phase load is a constant, so the DC current of the link should be fairly constant as well, since the power is constant. So, we can read the DC current in the same way, as an average, to get the power, and by knowing the motor characteristics, we can compensate for efficiency to get an accurate reading.

Now we also can determine the motor's speed by direct measurement or by assuming that it is running within its rated slip, and we know the frequency and number of poles, so we can determine its speed to a good approximation. Since torque is proportional to P/RPM, we can determine the torque. And in fact it can be determined by the bus current.

Of course, the actual RMS voltage applied to the motor is a function of the PWM, but this is fairly easily calculated, so we can scale the bus current by the bus voltage * duty cycle * sqrt(2), in which case the DC bus current can be a direct indicator of torque.

So, perhaps direct torque control can be accomplished with only two ADCs, which do not need to be simultaneous or fast, and a means of verifying actual motor speed. This can be done with an external sensor or back EMF. And one way to determine that is to adjust the PWM until reverse bus current (or even a dip in bus current) is sensed, which indicates that the motor is running and can become a generator when driven below synchronous speed.

It is probably better to have individual current sensors in each leg of the motor. But I think these can be simple, inexpensive CTs which can provide the information to perform a true-RMS computation and determine if the current is within specification. It should be possible to determine if the motor has stalled or is within the usable range up to breakaway torque current.

The controller should be able to provide DTC by monitoring these values and adjusting the drive PWM accordingly.

Another method that I have seen mentioned is to use a variable bus voltage, so you can use a PWM that just follows a sine table for 100% and vary the frequency to get desired speed, and adjust a separate PWM for the bus voltage. That requires a separate buck supply, however, so it may not be practical, especially if the batteries directly provide the bus voltage. But if a step-up DC-DC is used, as my my project has so it can power a 240 VAC motor from a single 12V battery, it might be an option.

Just some food for thought!


----------



## bjfreeman (Dec 7, 2011)

PStechPaul said:


> This discussion has been very helpful to my understanding of the operation of the VFD and the requirements for measurement of motor parameters. I can see the point that the motor voltage will be essentially the same as the DC link voltage because it is always either at link+ or link-, and we know when that is because the drive does the commutation. As for the difference between delta and star connection, I think it does not really matter except for the actual driving voltage differing by 2*sin(30) or sqrt(3), about 1.73, or 480/277.
> 
> However, I think the current measurement must be adjusted for the phase angle to get the current for the desired pole of the motor. The torque is proportional to the current.
> 
> ...


The Sinusoidal is a product of the Inductance, however the DC Bus is not constant, since the actual flow is pulsed.
It takes a capacitor bank rated in the farads to reduce the fluctuation caused by the inductance of the wiring from the batteries.


> The actual power consumed by the motor is equal to the product of the DC voltage and current, and IIRC the sum of the RMS currents in a three phase load is a constant, so the DC current of the link should be fairly constant as well, since the power is constant. So, we can read the DC current in the same way, as an average, to get the power, and by knowing the motor characteristics, we can compensate for efficiency to get an accurate reading.


Power is only constant, if the speed is constant. which in a EV it is not. Even at the "constant speed" the Drivers foot is actually moving as well as uneven plane the EV travels, so there is an oscillations. 


> Now we also can determine the motor's speed by direct measurement or by assuming that it is running within its rated slip, and we know the frequency and number of poles, so we can determine its speed to a good approximation. Since torque is proportional to P/RPM, we can determine the torque. And in fact it can be determined by the bus current.


based on above, even the slip varies. so you can get regen, which will increase the DC Bus voltage.


> Of course, the actual RMS voltage applied to the motor is a function of the PWM, but this is fairly easily calculated, so we can scale the bus current by the bus voltage * duty cycle * sqrt(2), in which case the DC bus current can be a direct indicator of torque.
> 
> So, perhaps direct torque control can be accomplished with only two ADCs, which do not need to be simultaneous or fast, and a means of verifying actual motor speed. This can be done with an external sensor or back EMF. And one way to determine that is to adjust the PWM until reverse bus current (or even a dip in bus current) is sensed, which indicates that the motor is running and can become a generator when driven below synchronous speed.


The normal is two sensors, however most AVR have more than one input per ADC so you don't read the ADC but variable that represents the Channel.
In a EV it is desirable to have the Motor do Regen, like when slowing or going down a grade.


> It is probably better to have individual current sensors in each leg of the motor. But I think these can be simple, inexpensive CTs which can provide the information to perform a true-RMS computation and determine if the current is within specification. It should be possible to determine if the motor has stalled or is within the usable range up to breakaway torque current.
> 
> The controller should be able to provide DTC by monitoring these values and adjusting the drive PWM accordingly.
> 
> Another method that I have seen mentioned is to use a variable bus voltage, so you can use a PWM that just follows a sine table for 100% and vary the frequency to get desired speed, and adjust a separate PWM for the bus voltage. That requires a separate buck supply, however, so it may not be practical, especially if the batteries directly provide the bus voltage. But if a step-up DC-DC is used, as my my project has so it can power a 240 VAC motor from a single 12V battery, it might be an option.


I use a step up (inverter) to feed a 765 DC bus, from 390 DC battery pack. This is only when the Motor first starts, before the Power Supply (Ice with generator, or Fuel Cells) start supplying power.
Not sure if you scoped the DC bus but pulling enough power (24KW) from a 12 volt to move even a lawn tractor you are pulling a hefty 2000 amps. Most cable 00 are rated at 300 amps. so you most definitely will have sag in the DC Bus.


> Just some food for thought!


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> The controller should be able to provide DTC by monitoring these values and adjusting the drive PWM accordingly.


Paul,
I think your missing the point here and the method you describe isn't anything to do with DTC, rather i think your describing how to get slip control working. For instance there is no PWM per se, rather a complex switching table which drives the gates. This switching table sets the gates depending on the current state of the machine, which, when operating correctly, generates a 3-phase sine wave. This is where DTC gets its variables switching frequency from.

Therefore, for basic DTC to work, you need only to accurately find the stator flux and torque. In DTC this is done by transforming voltage/current into the rotating D-Q plane. This can be done using 2 current sensors, knowledge of the 3 phase voltages (either via DC bus estimation [less accurate], or 3 voltage sensors), and the known stator resistance.

I'm not saying your theory wont work in some form, though i do see some errors in your logic - I'm just saying what your describing is not DTC.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> so the calculations not only have to take in to account the relationship between the Motor Rotor and the phase of the AC but the PWM that is creating it.


Which calculations? Vdq and/or Idq? I only make use of the phase voltages, and phase currents.

Or are you referring to some method of estimating the phase voltages?


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Which calculations? Vdq and/or Idq? I only make use of the phase voltages, and phase currents.
> 
> Or are you referring to some method of estimating the phase voltages?


input to the DTC estimation is phase voltage and current.
the output is estimated Flux. estimated torgue, Flux Sector.

estimated flux is integrate with Flux reference.
estimated torgue is integrate with Torgue reference.

the integrated Flux and Torgue, and the Flux Sector are inputted to the SVM. Actually SVPWM witch controls the power stage.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> input to the DTC estimation is phase voltage and current.
> the output is estimated Flux. estimated torgue, Flux Sector.


Yes, I understand. I have DTC working fine.
I was asking for which calculations do you use "the relationship between the Motor Rotor and the phase of the AC but the PWM that is creating it"?
It seems your calculations are different to mine and i was curious.



bjfreeman said:


> estimated flux is integrate with Flux reference.
> estimated torgue is integrate with Torgue reference.


OR the estimated Phi_d and Phi_q are integrated and the torque and flux are calculated from these.



bjfreeman said:


> the integrated Flux and Torgue, and the Flux Sector are inputted to the SVM. Actually SVPMW witch controls the power stage.


If you use SVPWM method - I am using DSVM method which is different.


----------



## bjfreeman (Dec 7, 2011)

Yes I also add a position input to the DTC to help with torque error at slower speeds.
I have found this to help with regen, since most happens in the lower speeds.


----------



## bjfreeman (Dec 7, 2011)

as a note all the code is being reviewed based on the new capabilities of the STM32F4 DSP and ADC conversion.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> Yes I also add a position input to the DTC to help with torque error at slower speeds.
> I have found this to help with regen, since most happens in the lower speeds.


Oh okay, yeh that'd help. I had a quick look when i first started this project for some estimation formula that used encoder speed feedback to increase the accuracy, but couldn't find any. I know there are some for the Vdq estimations out there somewhere, but i ended up being satisfied with the sensorless setup - and of course its easier to implement (no encoder needed).
I take it your using DTC-SVPWM as this is most similar to FOC.



bjfreeman said:


> as a note all the code is being reviewed based on the new capabilities of the STM32F4 DSP and ADC conversion.


Excellent, thanks.


----------



## bjfreeman (Dec 7, 2011)

the orginal code was calls with parameters passed.
so after the end of conversion I had to collect the data then pass it to the module.
Once I learned that the ADC uses DMA to store the channels for each ADC, on conversion, I change all the code to access the the memory locations where the DMA put them.

Now with all the timers I have I am putting the active module on a Timer that also runs the PWM.

The FOC calculates based on 


Voltage magnitude
Voltage angle (phase)
Frequency.
so when it is run it generates variable the SVPWM uses as well.
The variable created by DTC and FOC are compared to feed correction factor. this is done per full cycle. Love DSP.


----------



## Stiive (Nov 22, 2008)

bjfreeman said:


> the orginal code was calls with parameters passed.
> so after the end of conversion I had to collect the data then pass it to the module.
> Once I learned that the ADC uses DMA to store the channels for each ADC, on conversion, I change all the code to access the the memory locations where the DMA put them.


Yeh, gj, that's ideal.



bjfreeman said:


> The variable created by DTC and FOC are compared to feed correction factor. this is done per full cycle. Love DSP.


So your running a hybrid of DTC and FOC? Where did you get this idea? Or did you develop this yourself?
Have you done any comparison between DTC or FOC stand-alone? What improvements do you expect from this system?

My thoughts is it would be a good all-rounder. DTC would help the FOCs transient response. FOC would help the DTCs ripple.


----------



## bjfreeman (Dec 7, 2011)

to over-simplify the overview
the DTC say I estimate this is going on.
The FOC say I believe the is the state.
the Position says this is where I am do you agree.
after that is worked out the PWM is generated with the consensus.


----------



## bjfreeman (Dec 7, 2011)

Stiive said:


> Yeh, gj, that's ideal.
> 
> 
> 
> So your running a hybrid of DTC and FOC? Where did you get this idea? Or did you develop this yourself?


I am a systems integrator, it is my way of thinking to take the best of each.


> Have you done any comparison between DTC or FOC stand-alone? What improvements do you expect from this system?


one of my first jobs was working on the AWLS, redundancy was required. So I do that for all system that a human can screw up.


> My thoughts is it would be a good all-rounder. DTC would help the FOCs transient response. FOC would help the DTCs ripple.


exactly.


----------



## Stiive (Nov 22, 2008)

Stiive said:


> Wouldn't happen to have the model number handy, would you? I cant seem to find any flyback capable of ~400V or with that many secondaries.


 Stickytechnology,
This got lost a few pages back in the talk about PWM. 
Is the transformer internal or external?


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Stickytechnology,
> This got lost a few pages back in the talk about PWM.
> Is the transformer internal or external?


It's an external, custom part. That's the tricky bit about designing a flyback- you need a gapped core or a distributed air gap toroid, and custom windings. There are a few off-the-shelf flyback transformers available, but none with such an exotic secondary.

The controller can be anything- the system I have is just a handful of discrete parts. The main switch (that TO-220) is just a high voltage BJT.

I Like this controller, although I have never used it in a design:
http://www.digikey.com/product-detail/en/LNK501GN-TL/596-1030-1-ND/865372

It allows high voltage input and it is cost effective. You could probably get away with using 7 or so separate supplies based on this for the gate drives and MCU supply along with a simple hand-wound powdered iron toroid transformer.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> I'm getting confused... Why are we discussing PWM?
> 
> Are we trying to prove/disprove that the voltage in the phase is either Vdc or 0?
> If so, I say this is incorrect and is only an approximation. Remember the induction motor has inductance, obviously. When there's a change to the current in an inductor, a voltage is induced to oppose this change.
> ...


You're wrong  You're right that the rate of change of the current is proportional to the voltage, but since the windings are always connected, it's the voltage driving the current change, not the other way round. The 8 states of the inverter (at least in DTC) are:
-----------
state 
u'v'w' Description
u v w
-----------
O
000 All low side switches on; 0V across all windings
111

I 
100 U high side on, Vbat across U->(V+W)
011

II 
110 U and V high side on Vbat across (U + V) -> W
001

III 
010 V high side on, Vbat across V -> (U+W)
101

IV 
011 V and W high side on, Vbat across (V + W) -> U
100 opposite of state I

V 
001 W high side on, Vbat across W -> (U + V)
110 opposite of state II

VI 
101 U and W high side on, Vbat across (U + W) -> V
010 opposite of state III

VII 
111 All high side on, 0V across all windings, so identical to 
000 state O. Switching algorithm will choose state O or VII to 
minimize transitions.

Note that states like:
001
010 

never occur in DTC. In this case, the voltage on the U terminal is indeterminant.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Therefore, for basic DTC to work, you need only to accurately find the stator flux and torque. In DTC this is done by transforming voltage/current into the rotating D-Q plane. This can be done using 2 current sensors, knowledge of the 3 phase voltages (either via DC bus estimation [less accurate], or 3 voltage sensors), and the known stator resistance.


Actually, the beauty (to me) of DTC is no vector transformation is needed. All the calculations take place in the fixed frame. This is what led me to even attempt the algorithm on an 8-bit 20MHz micro


----------



## PStechPaul (May 1, 2012)

That LNK501 is a pretty handy part. But most IGBT and MOSFET high side drivers seem to use a bootstrap to get the voltage for the gate drive. Here are some references to this method and others as applied to motor controllers and power supplies:
http://www.ixysrf.com/pdf/switch_mode/appnotes/5mosfet_driver_theory_and_applications.pdf
http://www.fairchildsemi.com/ds/FA%2FFAN7081_GF085.pdf
http://www.fairchildsemi.com/ds/FA/FAN7382.pdf
http://www.darrahelectric.com/uploads/techLib/IGBT-Intelligent-PwrMods__633910403858373190.pdf
http://en.wikipedia.org/wiki/Bootstrapping_(electronics)

There are also some really cool integrated modules for smaller AC motor control. I have one of the 600V 10A modules (which is probably good for 2 HP nominal), and they have a 30 amp version for perhaps as much as 5 HP. They are about $23 and $50 respectively, and need only a few external components and a microcontroller to provide the PWM drive and respond to such signals as overcurrent, undervoltage, and temperature:
http://www.mouser.com/ProductDetail...=UY5Al7sGw1Ge4kgs9T3KYx8j5dPmqs4cG6fHaXn7ozA=
http://www.mouser.com/ProductDetail...2beY1k3TIJw4CxY8RfrOm%2bSJFFTYs64O9tvbpZqiQU=

I may try to use it along with a PIC18F2331 or 4331 for a simple VF drive, and also incorporate a DC-DC converter so that you will have, essentially, a box that connects to two or three batteries and drives a 240V three phase motor up to 5 HP. I think it could be built for under $100 exculding NRE, and it would be an interesting project.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> You're wrong  You're right that the rate of change of the current is proportional to the voltage, but since the windings are always connected, it's the voltage driving the current change, not the other way round.


Assuming you have no dead-time? Very risky strategy indeed!




stickytechnology said:


> Actually, the beauty (to me) of DTC is no vector transformation is needed. All the calculations take place in the fixed frame.


Depending on what method your using to estimate the torque and flux. IMO the most common and easiest way is by using the DQ current and voltage vectors, this way you only need the stator resistance.


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> That LNK501 is a pretty handy part. But most IGBT and MOSFET high side drivers seem to use a bootstrap to get the voltage for the gate drive. Here are some references to this method and others as applied to motor controllers and power supplies:
> http://www.ixysrf.com/pdf/switch_mode/appnotes/5mosfet_driver_theory_and_applications.pdf
> http://www.fairchildsemi.com/ds/FA%2FFAN7081_GF085.pdf
> http://www.fairchildsemi.com/ds/FA/FAN7382.pdf
> ...


The problem with these is that you lose your isolation. That doesn't matter so much in white goods with a grounded chassis, but with a car, I think it's critical. It is amazing what they're doing these days with the high-voltage ICs, though.




PStechPaul said:


> I may try to use it along with a PIC18F2331 or 4331 for a simple VF drive, and also incorporate a DC-DC converter so that you will have, essentially, a box that connects to two or three batteries and drives a 240V three phase motor up to 5 HP. I think it could be built for under $100 exculding NRE, and it would be an interesting project.


I'd buy that  I had a similar idea, where all the HV electronics would fit in a replacement junction box on the motor. I kind of stuck on the problem that with that boost ratio, you're going to be 70% efficient at best. I also thought you could get your motor rewound for lower voltage, but then the cost starts to add up, and you have all that I^2 loss.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Assuming you have no dead-time? Very risky strategy indeed!


You need dead time, of course, but that's only 600ns or so per transition. If your loop runs at 40kHz, you're dead only about 2% of the time, worst case. It would be hopeless trying to measure anything during switching anyway- you have horrendous transients banging around during those 600ns, and for quite a few microseconds afterward. The flux estimator is an integrator anyway, so the indeterminacy during switching doesn't contribute much. It's much worse having small offsets in your measured variables, because they can cause drift, especially at low speed.




Stiive said:


> Depending on what method your using to estimate the torque and flux. IMO the most common and easiest way is by using the DQ current and voltage vectors, this way you only need the stator resistance.


It's confusing, because some books use dq as the orthogonal fixed reference frame (as opposed to the DQ frame, which rotates with the rotor), and some use alpha and beta for the orthogonal fixed frame, dq for the rotating frame, and DQ for the transform from three phase space to the rotating frame (Park transform)

In any case, DTC only requires transform from the three phase space to the fixed orthogonal space, which doesn't involve sin and cos, only factors of √3/2.


----------



## PStechPaul (May 1, 2012)

stickytechnology said:


> The problem with these is that you lose your isolation. That doesn't matter so much in white goods with a grounded chassis, but with a car, I think it's critical. It is amazing what they're doing these days with the high-voltage ICs, though


I'm still not sure if isolation is really necessary. At the very least, I would think the battery negative should be tied to ground, although possibly through a shunt for current measurement. 



> I'd buy that  I had a similar idea, where all the HV electronics would fit in a replacement junction box on the motor. I kind of stuck on the problem that with that boost ratio, you're going to be 70% efficient at best. I also thought you could get your motor rewound for lower voltage, but then the cost starts to add up, and you have all that I^2 loss.


I contacted a motor rewind shop a while back, and I think they said it would be about $500 to rewind a 5HP motor. Larger motors probably would not cost any more in labor, but mostly materials. Copper wire is expensive. But I think it should be enough to use a 240/480 motor and maybe rewire star to delta. That should make it about 140 volt nominal, and you can probably overclock it by 3x with 180Hz at 420V to get 3x the HP. Beyond that you may need special laminations to reduce core losses.

It's better to be able to run smaller gauge wire to the motor, anyway, so for a 40 HP automotive application you would be able to use 480V at 36 amps per phase for which #10 or #8 would be sufficient. 

I just made an improvement to my DC-DC converter, by adding 6A MOSFET drivers, (and I upped the frequency from 500 to 2000 Hz, and it greatly increased the efficiency. It was drawing 2.6A at 12.6V and 3.8A at 13.9V, at which point it became unstable and tripped the current limit. But with the drivers it drew 1.28A at 12V, 1.38A at 13V, and 1.55A at 15V. I didn't go higher because at that point the doubler circuit was putting out about 400V. I want to use two batteries in series and if it's a linear relationship there will be about 2.5A at 24V, or 60 watts of core loss. At 1500 watts output I expect copper losses of about 20 watts. So 80 watts of losses with 1500W output is close to 95% efficiency. At worst it should be at least 90%. 

The drive is about 95%. The biggest losses will likely be in the motor at about 80% and the batteries probably about the same.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> In any case, DTC only requires transform from the three phase space to the fixed orthogonal space, which doesn't involve sin and cos, only factors of √3/2.


Yeh, mine doesn't require sin/cos but the papers I'm getting my formula from state that its a transfer into the rotating frame. 
Either way, doesn't really matter as long as it works


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I'm still not sure if isolation is really necessary.


At minimum you definitely need isolated power for the gate drivers otherwise your in for some costly fireworks


----------



## PStechPaul (May 1, 2012)

Stiive said:


> At minimum you definitely need isolated power for the gate drivers otherwise your in for some costly fireworks


Not necessarily. Bootstrap circuits work on at least 500V rails.

http://www.fairchildsemi.com/an/AN/AN-6076.pdf
http://www.ixysrf.com/pdf/switch_mode/appnotes/5mosfet_driver_theory_and_applications.pdf

And even 1200 VDC:
http://www.irf.com/product-info/cic/fsgatedriverics.html

They are floating supplies, but not isolated. It might be a good idea to use optocouplers for the drive signals, however.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Not necessarily. Bootstrap circuits work


Lol, okay got me on a technical


----------



## Stiive (Nov 22, 2008)

BTW, designing my controller around these gate drivers

http://www.semikron.com/products/data/cur/assets/SKYPER_32_PRO_R_UL_L6100204.pdf

Great unit, does all your dead time / fault shutdown / isolation / washing-up for you. 
Would recommend to anyone doing a ground-up build.

Currently designing my PCB, will post more details later


----------



## subcooledheatpump (Mar 5, 2012)

I've heard bootstrap circuit work, but I've never seen them work. 

I've tried them myself, no luck. Any VFD I've ever taken apart has used a seperate isolated power supply. 

Not trying to be rude or say it's a bad idea, but wouldn't you think that a bootstrap would really prone to noise?


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> I contacted a motor rewind shop a while back, and I think they said it would be about $500 to rewind a 5HP motor. Larger motors probably would not cost any more in labor, but mostly materials. Copper wire is expensive. But I think it should be enough to use a 240/480 motor and maybe rewire star to delta. That should make it about 140 volt nominal, and you can probably overclock it by 3x with 180Hz at 420V to get 3x the HP. Beyond that you may need special laminations to reduce core losses.
> 
> It's better to be able to run smaller gauge wire to the motor, anyway, so for a 40 HP automotive application you would be able to use 480V at 36 amps per phase for which #10 or #8 would be sufficient.


The star-to-delta trick is what I have planned for my car. I opened up the motor, and the star point is easily accessible, so I'm just going to add 3 more terminals in the junction box like a normal 9-terminal motor. I'm running a metric 112M frame in my car because I got a good deal on an aluminum framed one.



PStechPaul said:


> I just made an improvement to my DC-DC converter, by adding 6A MOSFET drivers, (and I upped the frequency from 500 to 2000 Hz, and it greatly increased the efficiency. It was drawing 2.6A at 12.6V and 3.8A at 13.9V, at which point it became unstable and tripped the current limit. But with the drivers it drew 1.28A at 12V, 1.38A at 13V, and 1.55A at 15V. I didn't go higher because at that point the doubler circuit was putting out about 400V. I want to use two batteries in series and if it's a linear relationship there will be about 2.5A at 24V, or 60 watts of core loss. At 1500 watts output I expect copper losses of about 20 watts. So 80 watts of losses with 1500W output is close to 95% efficiency. At worst it should be at least 90%.
> 
> The drive is about 95%. The biggest losses will likely be in the motor at about 80% and the batteries probably about the same.


That's cool, I didn't realize it had gone beyond the armchair engineering phase that most of my projects are in  What topology converter are you using?


----------



## PStechPaul (May 1, 2012)

It's just a simple push-pull square wave driving a transformer with a center tap. I have just 8 turns of #10 AWG on each primary, and the secondary is 100 turns of #18. The core is a 500 VA Powerstat (toroid). At the original design frequency of 60 Hz it was probably 0.25 volts/turn. But at 500 Hz I figured 2.5 volts/turn (RMS). Probably about the same for a square wave. So 8 turns should be about 20 volts peak and at 2 kHz up to 80 volts. So it should be fine for 2-4 batteries in series, or up to 56 volts. But my MOSFETs are only rated to 100V so I need to limit this version to three batteries, or 42 volts. You get twice the applied voltage during the off cycle.

The secondary just goes to a full wave bridge, with two large capacitors in series, so by connecting their common point to one side of the bridge, it becomes a voltage doubler, with about 320V output. I'll add a switch so it will still give 320V with two batteries. The main difficulty is transients during the time both drivers are off. I have TVS diodes across the MOSFETs and I may add a snubber across the transformer.

I'm generating the square wave with a PIC16F684, and the dead time is about 1 uSec. I have a simulation in LTSpice. I can post the file if interested, but I probably have to copy it as text into the post. Any way to post a file?


----------



## MPaulHolmes (Feb 23, 2008)

I'm using 6 isolated supplies. The 3 high side supplies are a single ATTINY that's doing a push-pull at around 75khz, which feeds the 2 inputs of an ixdn604 dual driver, which push-pulls three 1-1 3mH line filters. The line filters are just off the shelf components that are about $0.80 each. Then you rectify each of the 3 isolated outputs. I do a similar thing with the 3 low side supplies. Each dual driver can do 100mA no problem at 24v. 

Here you can see the low side board with the 3 line filters mounted to the power board. Four TO-247 igbts per phase being driven -8.2v to 15v or so.


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> It's just a simple push-pull square wave driving a transformer with a center tap. I have just 8 turns of #10 AWG on each primary, and the secondary is 100 turns of #18. The core is a 500 VA Powerstat (toroid). At the original design frequency of 60 Hz it was probably 0.25 volts/turn. But at 500 Hz I figured 2.5 volts/turn (RMS). Probably about the same for a square wave. So 8 turns should be about 20 volts peak and at 2 kHz up to 80 volts. So it should be fine for 2-4 batteries in series, or up to 56 volts. But my MOSFETs are only rated to 100V so I need to limit this version to three batteries, or 42 volts. You get twice the applied voltage during the off cycle.
> 
> The secondary just goes to a full wave bridge, with two large capacitors in series, so by connecting their common point to one side of the bridge, it becomes a voltage doubler, with about 320V output. I'll add a switch so it will still give 320V with two batteries. The main difficulty is transients during the time both drivers are off. I have TVS diodes across the MOSFETs and I may add a snubber across the transformer.
> 
> I'm generating the square wave with a PIC16F684, and the dead time is about 1 uSec. I have a simulation in LTSpice. I can post the file if interested, but I probably have to copy it as text into the post. Any way to post a file?


This seems like a good application for a resonant forward converter, eg Royer oscillator:
http://en.wikipedia.org/wiki/Royer_oscillator
http://www.neon-john.net/Induction/Roy/Roy.htm
like you might find in a CF light power supply. There are big efficiency gains in resonance, because you can switch at zero voltage and/or current.


----------



## Otmar (Dec 4, 2008)

MPaulHolmes said:


> The line filters are just off the shelf components that are about $0.80 each.


I like the idea of using line filters as cheap transformers! I also use one in a simple buck converter in the Zilla for the main power supply. The advantage is that it runs from 25V to 450V input and puts out a coarse 15V at 500mA. It is not isolated but I don't mind since I like keeping the main processor referenced to B- and isolating other things as needed including the throttle connection. 

Details on the buck converter can be found in the old design idea here, I don't think it is on the power integrations site anymore. Of course power can be increased with a larger switch and inductor. 
http://www.nalanda.nitc.ac.in/industry/appnotes/PowerInt/di1.pdf


----------



## PStechPaul (May 1, 2012)

stickytechnology said:


> This seems like a good application for a resonant forward converter, eg Royer oscillator:
> http://en.wikipedia.org/wiki/Royer_oscillator
> http://www.neon-john.net/Induction/Roy/Roy.htm
> like you might find in a CF light power supply. There are big efficiency gains in resonance, because you can switch at zero voltage and/or current.


In the Wiki there was reference to a comprehensive article by Jim Williams: http://cds.linear.com/docs/Application Note/an65f.pdf

It seems the Royer oscillator is designed for DC to AC conversion with a sinusoidal output, but this is not what you want for a DC-DC converter. It also requires a specially built saturable core transformer.

The square wave push-pull converter is ideal for DC-DC conversion because the output from the FWB is already almost pure DC, with just some gaps during the switching dead-time. This is only one or two microseconds, so the energy storage capacitors can be very small. The efficiency is determined by the on resistance of the MOSFETs, the core losses of the transformer, and the copper winding losses. All of these can be made almost arbitrarily low, at the expense of size, weight, and cost. So a 90-95% target efficiency seems reasonable enough and the overall efficiency of the system will be mostly determined by the batteries and the motor.

I did not see any efficiency ratings for the Royer oscillator "Roy", and, again, it produces AC, probably at high frequency for induction heating purposes. But I still need to test my converter at higher power levels. The original design only provided about 250 watts, which was pretty much the safe limit for a single 17 A-H SLA battery.


----------



## Stiive (Nov 22, 2008)

Well so given everyone is using a different type of DC-DC, lets deduce which will be best for my project 

These are the different DC power requirements.

Gate Drivers: +15V +-4% with minimum peak 1A*3gates (=3A). Rise time<50ms. No isolation required
(http://www.semikron.com/products/data/cur/assets/SKYPER_32_PRO_R_UL_L6100204.pdf)

MCU: +3.6V 150mA. Isolation preferred - high accuracy/noise immunity required for ADC ref
(http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/DM00037051.pdf)

Current sensors: 12-15V +-5% +-15mA. High noise immunity i guess
(http://www.lem.com/docs/products/htb -p_tp v12 e .pdf)


To limit noise/EMI/cost in the inverter, I'm thinking boosting the 12V battery voltage over bucking the DC bus - but am happy to explore both


----------



## PStechPaul (May 1, 2012)

If you have a 360V battery pack, you can use an ordinary 240 VAC switching supply which has a 350 VDC internal link. Even if your battery pack is higher, you can just tap off enough of them to get the DC voltage needed. 144 VDC would be fine. A 15V 1A switcher is maybe $20. And same for the 3.3VDC supply.

Best to use standard off-the-shelf components wherever possible.


----------



## Stiive (Nov 22, 2008)

Got some part numbers? 
Concerned with some of the ones I have researched previously not having a wide enough HV spread. 

Bus voltage will most likely be ~ 300-420V, but was hoping to have a versatile system that will allow me to test at lower voltages (say <100V while I iron out the bugs)


----------



## PStechPaul (May 1, 2012)

Here is a 3.3V supply that's good for 90-277 VAC, which is equivalent to 127 to 391 VDC. 300 mA (1W), $16:
http://www.digikey.com/product-detail/en/RAC01-3.3SC/945-1400-5-ND/2652153

And 15V at 267mA (4W), 90-264 VAC (127 to 373 VDC), for $24
http://www.digikey.com/product-detail/en/RAC04-15SA/945-1068-ND/2256248

Others:
http://www.newark.com/tracopower/tmlm-04115/psu-pcb-mount-15dvdc/dp/51R5391?
http://www.newark.com/tracopower/tmlm-04103/psu-pcb-mount-3-3dvdc/dp/51R5387

For 36-75 VDC input:
http://www.newark.com/tracopower/tes-2n-4810/dc-dc-converter-smd-2w-3-3v/dp/51R5134
http://www.newark.com/tracopower/tes-2n-4813/dc-dc-converter-smd-2w-15v/dp/51R5137


----------



## Stiive (Nov 22, 2008)

Thanks for that! No wonder I didn't find these earlier, I assumed these AC converters wouldnt work with DC input, but I guess cus these are variable freq AC they can though. None of them seem to show a schematic of the internals... Do they normally rectify the ac then flyback/forward/push-pull? 

Very low efficiency, but that doesnt bother me too much.


----------



## Stiive (Nov 22, 2008)

Cant seem to find one of these switching supplies with 15V output at the current I need


----------



## PStechPaul (May 1, 2012)

You should be able to find an open frame switcher with 15 volts at 1 amp, and they make much larger ones as well. But for gate drive, you really only need like 1 amp peak, to charge the IGBT gate capacitance, so just hang a decent size low ESR cap on the output and you're good to go.

All switching supplies AFAIK have a bridge rectifier at the input and a large filter capacitor rated at about 400 VDC. You can just connect the DC to the AC input as long as the diodes are conservatively rated. If you have an open frame supply you can just bypass the rectifier, although a diode might be a good idea to keep the supply capacitor from draining when your main battery pack sags under heavy acceleration.

You could even use one of these with 1.6A for only $6:
http://www.mpja.com/15VDC-16A-Regulated-Plug-Supply-GME/productinfo/18724+PS/
or if you want 2.8 amps for about $25:
http://www.mpja.com/15V-28A-40W-Power-Supply/productinfo/16002+PS/


----------



## Stiive (Nov 22, 2008)

Haha, didn't think of using a laptop charger.
However, considering these don't give really give me the voltages I want, what did you mean by this comment?



PStechPaul said:


> Even if your battery pack is higher, you can just tap off enough of them to get the DC voltage needed. 144 VDC would be fine.


----------



## PStechPaul (May 1, 2012)

Stiive said:


> Haha, didn't think of using a laptop charger.
> However, considering these don't give really give me the voltages I want, what did you mean by this comment?


I'm assuming you have multiple 12V batteries wired in series so you can tap off of the intermediate connections for multiples of 12V. And 144V is at the low end of rating for most AC-DC switchers, corresponding to about 100 VAC.

I thought you needed 15V at 1A for the gate drives, and 3.3V at 500mA for the processor. I see now that you need 3.6V. But that should be standard as well: http://www.mpja.com/36V-22A-Desktop-Supply-KETI/productinfo/18357+PS/, or you can use a 5V supply and a linear regulator. You could use a wide input 12V nominal DC-DC converter for both, and the 15V high side gate drive power supply should be connected to the top 12V battery to minimize the common mode voltage. And the 3.6V can be a 2W DC-DC on the bottom 12V battery.

For the same output power, a DC-DC converter or an AC switching supply will draw less current at higher voltage. So the 15W gate drive supply will draw about 1.5 amp on 12V but less than 120mA on 144V. And the 3.6V supply needs only about 2W, or about 180mA from a 12V battery, and only about 15mA from 144VDC. At such low currents, you don't really need to worry about balancing the loads on the battery pack.

The current sensor supply may not need to be isolated or floating if it is a toroidal CT. There are all sorts of power supplies that can provide the 12V needed: http://www.mpja.com/12V2A-Hitron-Power-Supply/productinfo/18595+PS/


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> I'm assuming you have multiple 12V batteries wired in series so you can tap off of the intermediate connections for multiples of 12V. And 144V is at the low end of rating for most AC-DC switchers, corresponding to about 100 VAC.


This probably isn't a good idea, unless you charge individually as well...
How are you planning on charging your 12V aux battery, Stiive? This is the big reason I kept my pack voltage under 360V (96 LiFePO4), as you can use off-line converters for the 12V supply. The internal topology of a wall wart is generally a full bridge followed by a flyback, so they do work on DC, as PStechPaul mentioned.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I'm assuming you have multiple 12V batteries wired in series so you can tap off of the intermediate connections for multiples of 12V. And 144V is at the low end of rating for most AC-DC switchers, corresponding to about 100 VAC.



Yeh, that doesn't sound ideal, especially because I'll prob be testing with LiPo's and i don't want to cycle a few more than the others.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> How are you planning on charging your 12V aux battery, Stiive?


This project isn't actually for a EV atm, but if i'm going to make the hardware open-source might as well make it versatile




stickytechnology said:


> The internal topology of a wall wart is generally a full bridge followed by a flyback, so they do work on DC, as PStechPaul mentioned.


Guess I assumed they would just use the known frequency AC to flux the transformer, but that means it would only work in 1 country.



I have some 650V 75A trench IGBTs, perhaps ill just make my own DC-DC converter. If i convert to say 15V, then I can use some isolated DC-DC converters (e.g. 15V to 3.3V) to get my other voltages. 
Not the cheapest way, but should be relatively easy


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> This project isn't actually for a EV atm, but if i'm going to make the hardware open-source might as well make it versatile


What's the project?



Stiive said:


> I have some 650V 75A trench IGBTs, perhaps ill just make my own DC-DC converter. If i convert to say 15V, then I can use some isolated DC-DC converters (e.g. 15V to 3.3V) to get my other voltages.
> Not the cheapest way, but should be relatively easy


I'd probably go higher in voltage than that, and not so beefy in terms of current. Something like this:
http://www.digikey.com/product-detail/en/STGF3NC120HD/497-4353-5-ND/725341

Remember that if you use the flyback topology (simplest, as you only need one switch) the switch rating has to be at least: V_in + (V_out * turns ratio) + √(L_leakage I_in^2 /C_switchnode) so for a 400V input, a 20 turns ratio, and a 15V output, the first two terms are already 700V. The third term is impossible to calculate, as it depends on the leakage inductance and the parasitic capacitance of the switch node, which you won't know until you build the circuit, but probably count on another couple of hundred volts. 

As an example, the offline supplies we were talking about earlier (wall warts) usually have 700 or 900V switches, for a 360V input rail.


----------



## PStechPaul (May 1, 2012)

I'm dealing with the inductive spike issue in my DC-DC converter design. I'm using a 2 kHz square wave with 1 uSec dead time, and at 20 volts I was seeing the 40 volts as expected but also a spike up to about 80 volts, and even higher as I raised the supply voltage. I was able to reduce it somewhat by adding snubbers, but it was still not enough to guarantee that I'd stay within the 100V Vds specification of my HUF75645 MOSFETs. I had one fail as I was doing some of the testing, and it seemed to be especially bad after I added fast 9A UCC27321 gate drivers.

In my simulation, I found that I could use 100 ohm gate resistors and add 0.1uF capacitors from gate to GND, and it reduced the initial startup spikes as well as the steady-state. And the efficiency was still pretty good. The MOSFETs were only dissipated about 5 watts each, with 350 watts output. I have not yet implemented this in the actual circuit, but I will.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> What's the project?


Just to get the motor spinning at the moment




stickytechnology said:


> I'd probably go higher in voltage than that, and not so beefy in terms of current. Something like this:
> http://www.digikey.com/product-detail/en/STGF3NC120HD/497-4353-5-ND/725341
> 
> Remember that if you use the flyback topology (simplest, as you only need one switch) the switch rating has to be at least: V_in + (V_out * turns ratio) + √(L_leakage I_in^2 /C_switchnode) so for a 400V input, a 20 turns ratio, and a 15V output, the first two terms are already 700V. The third term is impossible to calculate, as it depends on the leakage inductance and the parasitic capacitance of the switch node, which you won't know until you build the circuit, but probably count on another couple of hundred volts.
> ...


Thanks for the formula, that one is new to me. However, I was thinking of using a simple forward buck converter topology to step down to 15V as I don't need isolation or therefore a transformer. From there I can use isolated DC-DC to get the other voltages. 
I think in this case a diode should keep the voltage seen by the switch in check - do you have any calcs for this topology?

Yeh the current rating of the IGBT is a bit high, but I have a few of them lying around... but then again, how do i provide the 15V required for the gate driver without the output of the buck converter? Might have to source something else that can run off the 12V battery.

Guess I should look for the ideal solution, not the "found lying around my room" solution


----------



## Stiive (Nov 22, 2008)

Thanks for your info Paul



PStechPaul said:


> I'm dealing with the inductive spike issue in my DC-DC converter design. I'm using a 2 kHz square wave with 1 uSec dead time, and at 20 volts I was seeing the 40 volts as expected but also a spike up to about 80 volts, and even higher as I raised the supply voltage.


Am I right in understand you are boosting voltage 2:1? What will this boost converter be used for?



PStechPaul said:


> In my simulation, I found that I could use 100 ohm gate resistors and add 0.1uF capacitors from gate to GND, and it reduced the initial startup spikes as well as the steady-state. And the efficiency was still pretty good. The MOSFETs were only dissipated about 5 watts each, with 350 watts output. I have not yet implemented this in the actual circuit, but I will.


Out of curiosity, what electronics simulator are you using?


----------



## PStechPaul (May 1, 2012)

I am boosting 24VDC from 2 batteries to about 300VDC for a VFD so I can power a 240 VAC 3 phase motor. Previously I had the output connected in doubler mode, so I got 300 VDC from just one 12V battery. You can see it in action where I take a ride on my electric tractor, using just one 17 A-H battery, and drawing only about 250 watts. 
http://youtu.be/y0qWY4bVnEA

I'm using LTSpice, which is totally free and very powerful. If you use Linear Technology components, they have just about every model as well as basic circuits. Here's the schematic, from a screen capture:










And a screen shot of the simulation showing some of the waveforms:










If you want to use this tool, just download it from:
http://www.linear.com/designtools/software/

You can also load the ASC file for this DC-DC converter:
http://www.enginuitysystems.com/pix/12V-300V_CT_Doubler.asc

It's a simple text file.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I am boosting 24VDC from 2 batteries to about 300VDC for a VFD so I can power a 240 VAC 3 phase motor. Previously I had the output connected in doubler mode, so I got 300 VDC from just one 12V battery. You can see it in action where I take a ride on my electric tractor, using just one 17 A-H battery, and drawing only about 250 watts.
> http://youtu.be/y0qWY4bVnEA


Haha that's wicked!



PStechPaul said:


> I'm using LTSpice, which is totally free and very powerful. If you use Linear Technology components, they have just about every model as well as basic circuits. Here's the schematic, from a screen capture:
> 
> 
> 
> ...


Yeh i have LTSpice, I'm a bit of a hoarder with simulation software 
Might try loading that ASC file and see whats up.

Might also try a simple buck setup and see what sort of voltage spikes to expect


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I am boosting 24VDC from 2 batteries to about 300VDC for a VFD so I can power a 240 VAC 3 phase motor. Previously I had the output connected in doubler mode, so I got 300 VDC from just one 12V battery. You can see it in action where I take a ride on my electric tractor, using just one 17 A-H battery, and drawing only about 250 watts.
> http://youtu.be/y0qWY4bVnEA


FYI: Here's a random video I made of an EV racer build about 2 years ago. You don't learn much about the build from the video but you can see how much work went into it. Also includes a good explosion of when our controller decided randomly blow up the first time.
http://www.youtube.com/watch?v=a_9-WTgZS_Y&feature=context-chv

Here another video of the car on the dyno when we were still having problems
http://www.youtube.com/watch?v=PuhiSfeETfw&feature=plcp


We have since gone to a Tritium controller and everythings fine now. Atleast I learned alot from that crappy MES-DEA controller.

I have more recent videos of the vehicle that i'll prob put up sometime soon. (These were from 2010)


----------



## PStechPaul (May 1, 2012)

Pretty cool video. Racing cars and road vehicles are a different world from that of tractors and off-road utility vehicles. I also watched the video of the dyno testing and read through most of the thread, although it was from over a year ago and there were some unanswered questions. That sudden surge of torque was interesting, but the fact that it occurred just before synchronous speed seems to indicate that it was running past the breakdown torque with too much slip, and then became what it should be when the drive frequency came into the "zone". The graph of torque vs speed of an induction motor driven by a fixed frequency did look a lot like your results.

It would be interesting to see a datalog of the testing. What would be good is a data stream at about 1000-2000 samples per second with filtering to eliminate spurious spikes and PWM carrier. It would probably be enough to record the DC bus voltage and current at a slower rate, since it should not cahnge quickly, but the phase currents and voltages should be able to show the waveform and phase shift, and a tachometer pulse reading to show the rotor position in relation to the applied voltage and current. 

But it may be more useful to plot the drive frequency and shaft speed and slip, over time, to see where there might be reasons for torque variations.

I may be rambling on. Good luck with your projects. It is interesting to follow these discussions. I think I can bring in some unique knowledge and experience in certain areas, but I am probably learning more from you guys. Maybe I'll get inspired to make a roadworthy EV.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Just to get the motor spinning at the moment
> 
> Thanks for the formula, that one is new to me. However, I was thinking of using a simple forward buck converter topology to step down to 15V as I don't need isolation or therefore a transformer. From there I can use isolated DC-DC to get the other voltages.
> I think in this case a diode should keep the voltage seen by the switch in check - do you have any calcs for this topology?


That's probably the simplest way, although you still have the chicken/egg problem of how you start your converter without a source of low voltage. Some designs just use a high value resistor between the high voltage rail and the low voltage one (with a linear regulator) but that usually wastes quite a bit of power.

http://smps.us/ has a lot of nice summary info about different converters. You have to be careful, though. The formulas are for an ideal case ignoring parasitics (eg the third term in the formula I gave yesterday)


----------



## stickytechnology (Sep 19, 2010)

PStechPaul said:


> I am boosting 24VDC from 2 batteries to about 300VDC for a VFD so I can power a 240 VAC 3 phase motor. Previously I had the output connected in doubler mode, so I got 300 VDC from just one 12V battery. You can see it in action where I take a ride on my electric tractor, using just one 17 A-H battery, and drawing only about 250 watts.
> http://youtu.be/y0qWY4bVnEA


Sweet tractor! I'm amazed that gel cell is up to the job. I wonder if you did some work minimizing the leakage inductance of your transformer you might get rid of the snubbers? I couldn't tell from the video, but you might try twisting the primary leads between the switch/battery and the transformer (maybe two leads for the center tap, each twisted with a switch lead). Every nH counts!


----------



## PStechPaul (May 1, 2012)

Yes, I have a thread in sci.electronics.design that goes into great detail and I just did some tests with various capacitors and snubbers. I really don't think the lead dress will make a whole lot of difference at 2 kHz, but I'm sure it will help some. I have not yet tried snubbers from each drain to ground, however. Might be best to start a new thread here about the DC-DC converter, since it's not really on topic in this one.


----------



## NintendoKD (Apr 29, 2012)

Very interesting, I am going to follow this. I plan to build my own controller with ots parts.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Pretty cool video. Racing cars and road vehicles are a different world from that of tractors and off-road utility vehicles. I also watched the video of the dyno testing and read through most of the thread, although it was from over a year ago and there were some unanswered questions. That sudden surge of torque was interesting, but the fact that it occurred just before synchronous speed seems to indicate that it was running past the breakdown torque with too much slip, and then became what it should be when the drive frequency came into the "zone". The graph of torque vs speed of an induction motor driven by a fixed frequency did look a lot like your results.
> 
> It would be interesting to see a datalog of the testing. What would be good is a data stream at about 1000-2000 samples per second with filtering to eliminate spurious spikes and PWM carrier. It would probably be enough to record the DC bus voltage and current at a slower rate, since it should not cahnge quickly, but the phase currents and voltages should be able to show the waveform and phase shift, and a tachometer pulse reading to show the rotor position in relation to the applied voltage and current.
> 
> ...


Haha, the controller is long gone.. it blew up before we could do the testing we wanted... The final boom happened after we did an auto-tune, it completely successfully and saved the new parameters... Sat there for about 30secs and then blew up for no reason. Not a small bang either, big flames and all, few people lost their eyebrows! It should have just been sitting happily there in sleep mode... ahwel. 
As i said, new controller now


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> That's probably the simplest way, although you still have the chicken/egg problem of how you start your converter without a source of low voltage. Some designs just use a high value resistor between the high voltage rail and the low voltage one (with a linear regulator) but that usually wastes quite a bit of power.
> 
> http://smps.us/ has a lot of nice summary info about different converters. You have to be careful, though. The formulas are for an ideal case ignoring parasitics (eg the third term in the formula I gave yesterday)


Thanks for the link. I also have a friend helping me with the DC-DC now, so hopefully we can get something happening. Might use an isolated power from the battery to power the switching.

Also, I'm thinking of giving up now just have the whole bloody MCU setup HV live. This is going to be easiest and probably most stable. If i keep the MCU isolated then i have to isolate the voltage readings of the bus (or 3 -phases) which at my sample time 5e-6 is going to be too hard while maintaining accuracy.
Most/all of my input/output are going to be via CAN anyway, so i'll isolate that, RS232 and JTAG. Will prob have an isolated signal from the battery to turn on off, or i could power the MCU from the 12vbattery using an isolated DC-DC. I want to maintain isolation between the 12vbattery and HV side.


----------



## PStechPaul (May 1, 2012)

Stiive said:


> Haha, the controller is long gone.. it blew up before we could do the testing we wanted... The final boom happened after we did an auto-tune, it completely successfully and saved the new parameters... Sat there for about 30secs and then blew up for no reason. Not a small bang either, big flames and all, few people lost their eyebrows! It should have just been sitting happily there in sleep mode... ahwel.
> As i said, new controller now


Yeah, I had a flash-bang experience today. I had thoroughly tested my DC-DC converter, and I even hooked up the output to the VFD and I ran a 1.5 HP three phase motor from 25 VDC and 5A. I was able to adjust the speed with a pot and I even had a reversing switch, which worked just fine, and had an off position that stopped the motor. But it was just a little too much for the PS and the VFD kept tripping on undervoltage.

So, I went outside and connected everything to the tractor. I mounted the 12V SLA as well as a 12V garden tractor battery originally used to start the ICE. I connected the + of one and the - of the other to a polarized Anderson connector, and the other side went through a two pole 30 amp breaker and then the input of the DC-DC converter. I wired a 30A ammeter as a jumper between the two batteries.

I clicked the CB on, and I got some good size sparks and a bit of smoke from the area of the power input. Not enough to trip the breaker, but I quickly turned it off and looked for damage. I did not see anything, but I loosened the + input phenolic plate and tried again. It seemed to start for a second, but then more sparks that seemed to come from under the terminal block for the 300 VDC output. 

So, it was getting dark and I was tired, so I brought the whole shebang (except for the batteries) inside, and I looked for signs of arcing or burned components or debris. Nothing! I hooked it up to the current limited power supply and it worked fine. I was able to power up the VFD at 25 VDC and 2.5 amps. So it draws 62.5 watts by itself. Seems more than I would expect, but that's only 5% of its 2 HP capacity.

Well, maybe tomorrow I'll try again. Maybe the surge from the low ESR batteries caused a very high current. But why did it arc and spark? Maybe there was something in there, like a strand of wire, that finally vaporized. So, maybe I'll try again tomorrow....cautiously! 

[edit] I think I found the problem. When I added the gate drivers, I changed the PWM setup because they were inverting, so a high output from the microcontroller PWM pins turned the MOSFETs off. BUT, during initialization, I cleared the PORTC and then set it for output, and THEN I had a delay loop of 100 mSec before I activated the PWM. SO, for 100 mSec I was creating a direct short through the transformer primaries and the MOSFETs and the shunt to GND. Fortunately I had a fair length of #14 wire in the circuit, which kept the current from being outrageously high. Still, I figure there was no more than about 0.1 ohm in the circuit, so the 24 volt batteries would give me about 240 amps! I'm amazed that the MOSFETs survived.

Now I have also added a start-up sequence where I use a 12% PWM for 2.5 seconds, which hopefully will reduce the current and precharge the capacitors. I'm also thinking about adding an inductor in series with the capacitors. The start-up pulses are 256 uSec and the capacitors are 6600 uF. I'm hitting them with a 300 volt square wave. So, let's see, I = V*t/L, so a 10mH inductor would reach 7.68A. Hmm. Let me try that in my simulator.

Well, even with a 100mH inductor I'm getting 300A current pulses on the primary. But since it's about a 12:1 ratio, Maybe that's about right? Or maybe I calculated wrong?


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Yeah, I had a flash-bang experience today. I had thoroughly tested my DC-DC converter, and I even hooked up the output to the VFD and I ran a 1.5 HP three phase motor from 25 VDC and 5A. I was able to adjust the speed with a pot and I even had a reversing switch, which worked just fine, and had an off position that stopped the motor. But it was just a little too much for the PS and the VFD kept tripping on undervoltage.
> 
> So, I went outside and connected everything to the tractor. I mounted the 12V SLA as well as a 12V garden tractor battery originally used to start the ICE. I connected the + of one and the - of the other to a polarized Anderson connector, and the other side went through a two pole 30 amp breaker and then the input of the DC-DC converter. I wired a 30A ammeter as a jumper between the two batteries.
> 
> ...


How'd u go with this? Get it working again?
I've given up on my DC-DC buck converter for now... I was spending too much time on it and its not so crucial at the moment. I'll only do it if I have spare real estate on my PCB.


----------



## PStechPaul (May 1, 2012)

Actually I had another flash-bang experience on Monday. I was able to go for a ride and even drove up a small hill with no more than 20A at 24V out of the battery. But it tripped a 40A breaker and then arced and sparked, which I caught on video. Then I tried once more, with the camera off, and a significant amount of flame and magic smoke emanated from a pair of MOSFETs that finally shorted.  Here's the video:

http://youtu.be/j5TyhdY-cHQ

I have decided to build a current-limiting front end between the batteries and the converter. I can use two PNP power transistors and current sense resistors in parallel, to allow up to 80 amps before limiting. If it is just start-up current to charge the capacitors, it will only need to dissipate 24V*80A = 1920W for a "short" time, and then if the high current persists, in case of a short or malfunction, the circuit breaker will trip soon enough.

I'll also add proper TVS diodes to assure there will be no voltage spikes over the MOSFET rating of 100V. Then I'll try again.


----------



## PStechPaul (May 1, 2012)

Let me take a quick shot at this. 

1. I think you should use differential inputs for your voltage samples, or at least set up a virtual ground. It may be tricky to find a place on the ground bus that will not be noisy. And if you use differential inputs, you can read the actual voltages at the motor terminals, phases A-B, B-C, and C-A.

2. You may need to add trimmer capacitors across the voltage divider string and the sampling resistor, much like a scope probe compensation. In fact, you might consider using three scope probes so you can get a good waveform for higher accuracy.

3. Simultaneous sampling might be a good idea. The Microchip dsPIC 24 and 33 have this capability. And it appears that the acquisition time is as low as 130 nSec. The internal switch has about 3k resistance, and the sample capacitor is 4.4 pF. 10 time constants is 132 nSec, and good enough for 10 bit 0.1% accuracy.

4. Instrumentation amplifiers are ideal for such measurement, although they will generally need a +/- supply. The INA129 works on 2.25V to 15V supply rails and has a 4V/uSec slew rate, as well as other impressive gain, drift, CMRR, and offset specs. A differential input from a high voltage source can be done with four resistors.

5. The LT1498/LT1499 op-amps are pretty good and designed to drive a capacitive load, with 4.5 V/uSec. And the LT1630/LT1631 have 10V/uSec.

HTH


----------



## Stiive (Nov 22, 2008)

Just worth a mention that i'm now putting the filter cap on the input of the opamp in parallel with the R_VD_L resistor as per the other thread.



PStechPaul said:


> Let me take a quick shot at this.
> 
> 1. I think you should use differential inputs for your voltage samples, or at least set up a virtual ground. It may be tricky to find a place on the ground bus that will not be noisy. And if you use differential inputs, you can read the actual voltages at the motor terminals, phases A-B, B-C, and C-A.


I don't see the difference, apart from that I'd need to change my code, and assume all 3 phases are perfectly balanced



PStechPaul said:


> 2. You may need to add trimmer capacitors across the voltage divider string and the sampling resistor, much like a scope probe compensation. In fact, you might consider using three scope probes so you can get a good waveform for higher accuracy.


Yeh I could add a cap across the entire voltage divider string and maybe a diode on the input to stop it adding capacitance to the motor. Probably wouldn't be ideal if i was doing phase-phase unless it was only a few puffs. I think i can get the same effect by sizing the C_filter perfectly (changing it to the input+ of opamp). Just need to work out the darn time constant.

Which are you referring to as the sampling resistor? I have no resistor between the opamp and the ADC




PStechPaul said:


> 3. Simultaneous sampling might be a good idea. The Microchip dsPIC 24 and 33 have this capability. And it appears that the acquisition time is as low as 130 nSec. The internal switch has about 3k resistance, and the sample capacitor is 4.4 pF. 10 time constants is 132 nSec, and good enough for 10 bit 0.1% accuracy.


Yeh the STM32F4 I'm designing for has 3xADCs for [email protected] That gives 139nS aquisition. Thats a decent dsPIC but I'm not jumping ship yet.



PStechPaul said:


> 4. Instrumentation amplifiers are ideal for such measurement, although they will generally need a +/- supply. The INA129 works on 2.25V to 15V supply rails and has a 4V/uSec slew rate, as well as other impressive gain, drift, CMRR, and offset specs. A differential input from a high voltage source can be done with four resistors.
> 
> 5. The LT1498/LT1499 op-amps are pretty good and designed to drive a capacitive load, with 4.5 V/uSec. And the LT1630/LT1631 have 10V/uSec.


Thanks, i'll look into those opamps, though i don't need to drive capacitive loads anymore as i will put the filter cap on the input. I had found a great TI 4 channel opamp with great specs but its not cheap @ $7 a pop. http://www.ti.com/lit/ds/symlink/lmp2014mt.pdf . Guess you pay for precision. Maybe if i make a second order filter ill use it. Don't wanna use it for the 3-phases as i don't want my voltage dividers to get too close to each other due to the differences in potential.


Thanks for your help


----------



## stickytechnology (Sep 19, 2010)

Hi Stiive,

A problem I can see is the ground reference, as PSTechPaul pointed out. You can count on the phases going negative relative to the negative rail due to the drop across the low side switch, as well as ringing during dead times. This means one of the inputs of the opamps will be below its rail, which will make it unhappy for a good long time. Better to use a diff amp like PSTechPaul says, because the internal voltage divider can sometimes let you get away with inputs that exceed the rails one way or the other.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hi Stiive,
> 
> A problem I can see is the ground reference, as PSTechPaul pointed out. You can count on the phases going negative relative to the negative rail due to the drop across the low side switch, as well as ringing during dead times. This means one of the inputs of the opamps will be below its rail, which will make it unhappy for a good long time. Better to use a diff amp like PSTechPaul says, because the internal voltage divider can sometimes let you get away with inputs that exceed the rails one way or the other.


Ah okay, sorry PSTechPaul I didn't realise that's what you were getting at. But wouldn't the voltage drop cause the phase to be at the switch voltage drop ABOVE ground? And the internal FWD of the switch is hopefully quick enough to stop this from effecting my reading with my low pass filter.

Also might move my clamp to the input of the opamp, so the 2 schottkys should help/make it stay within the rails.

What you guys think?


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Ah okay, sorry PSTechPaul I didn't realise that's what you were getting at. But wouldn't the voltage drop cause the phase to be at the switch voltage drop ABOVE ground? And the internal FWD of the switch is hopefully quick enough to stop this from effecting my reading with my low pass filter.


Depends which way the current is flowing in the switch  If the FWD is conducting, you're at least 0.3V below the rail.



Stiive said:


> Also might move my clamp to the input of the opamp, so the 2 schottkys should help/make it stay within the rails.
> 
> What you guys think?


I think with the input clamp, you run the risk of measuring something other than what you want. Admittedly, I'm still not on board with the philosophy of measuring the phase voltages directly, but if you do so, it means you are interested in the fast transients that occur around the switching times, which means that you should take care with any kind of filtering, as it will destroy what you are looking for.

You mentioned earlier a large inverter that sensed phase voltage. Why not reverse engineer that?


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Depends which way the current is flowing in the switch  If the FWD is conducting, you're at least 0.3V below the rail.


Yes that's true if the FWD is conducting, but its not the FWD that causes the phase to be lower than ground. I think this should/could only happen on a balanced motor due to the inductance of the motor during dead time. I could be wrong




stickytechnology said:


> I think with the input clamp, you run the risk of measuring something other than what you want.


ASAIK the schottky diodes should not effect the readings to any noticeable degree.



stickytechnology said:


> Admittedly, I'm still not on board with the philosophy of measuring the phase voltages directly, but if you do so, it means you are interested in the fast transients that occur around the switching times, which means that you should take care with any kind of filtering, as it will destroy what you are looking for.


No, I'm looking for the steady-state voltages of the current switch state just before it changes. These will be sampled towards the end of the DTC sampling time, and will be used to calculate the new switching state.




stickytechnology said:


> You mentioned earlier a large inverter that sensed phase voltage. Why not reverse engineer that?


I have a 7.5kW inverter, but it is FOC and the requirements for speed/accuracy will be completely different.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Yes that's true if the FWD is conducting, but its not the FWD that causes the phase to be lower than ground. I think this should/could only happen on a balanced motor due to the inductance of the motor during dead time. I could be wrong


Current flows out of the negative rail (and into the positive rail) for a significant portion of each cycle. Regen is happening if there is a net sum in that direction.

I'm not trying to be rude, but I think you have a few conceptual problems with what's happening in the inverter. I can say this because I have been through a very similar process of trying to wrap my brain around it. What worked for me, and what I suggest you do, is step back and play with a six-step inverter. Either build a simple one, or model it up in LTSpice, and it will give you a lot of insight to the problem. It's directly applicable to the DTC problem anyway, as most DTCs switch over to six-step operation in the field weakening region.

Again, not trying to be rude, just sounds like your learning process is shaping up like mine


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Current flows out of the negative rail (and into the positive rail) for a significant portion of each cycle. Regen is happening if there is a net sum in that direction.


I have not seen this in my simulations, but then again I haven't particularly looked for it... maybe i'll extract my FWD from the IGBT module and place a current meter on it....
I thought you were a motor terminal is only either VDC- or VDC+ kind of guy  I was the only one arguing that the phase could be above/below the rails. Did you see my sinusoidal error results of the phase voltages via DC bus approximation?



stickytechnology said:


> I'm not trying to be rude, but I think you have a few conceptual problems with what's happening in the inverter.


Thats fair enough, I learn something new about this everyday.... I started this project only a few weeks before I began this thread... So only a month and a bit in.



stickytechnology said:


> I can say this because I have been through a very similar process of trying to wrap my brain around it. What worked for me, and what I suggest you do, is step back and play with a six-step inverter. Either build a simple one, or model it up in LTSpice, and it will give you a lot of insight to the problem. It's directly applicable to the DTC problem anyway, as most DTCs switch over to six-step operation in the field weakening region.


I have my complete model and code in SIMULINK.... I will significantly decrease my step time so it picks up all the transients (while keeping my DTC time step the same), and check out the results.



stickytechnology said:


> Again, not trying to be rude, just sounds like your learning process is shaping up like mine


I'm posting on here because I want people like you to give their thoughts. Don't worry about offending me, you've sparked me to do more research - this is a good thing.


----------



## PStechPaul (May 1, 2012)

My thoughts are that it may not be necessary to do these measurements with such a high degree of accuracy. If you just read the DC bus voltage to common, the actual motor voltage may be above or below the bus voltage or above or below GND by the diode drop of the FWD, or the saturation voltage of the IGBT. Under high current conditions, that may be several volts.

I think it is wise to measure the actual motor terminals to eliminate this error, and also to detect desaturation of the IGBT. It may also be a good idea to have a shunt on the common of the H-bridge to determine the peak current, and use a hardware means to shut off the PWM drive during the PWM cycle.

Since the motor lead voltages can go below GND, I think it is important to use +/- supplies on the op-amps. They may be able to tolerate inputs below the lower rail, but they cannot produce a negative output if they are single-ended. You can use a unipolar ADC such as those on a microntroller to read a bipolar signal by using an offset amplifier. Here is an example: http://masteringelectronicsdesign.com/design-a-bipolar-to-unipolar-converter/

Since the voltages are mostly above GND, you can just offset by perhaps 5%, and then you just need to subtract that offset from your ADC reading to get a signed integer value which can be negative. That's another benefit of using differential amplifiers. You can set the inverting input at, perhaps, 10 volts below GND, so a zero input on the non-inverting input will give a positive output for the ADC. 

But my original comment was about the required accuracy. I think it may only be necessary to read within 2% or 1%, which eliminates the 0.1% divider resistors and may allow 8 bit ADC readings which are faster for conversion time as well as processing, especially if you are using an 8 bit processor. Have you determined the actual effect of reading error on the motor performance? 

ISTM that the driver will apply adjustments of pedal position to get the speed and torque desired, and the motor controller only needs to keep the motor within safe operating limits. So you could just determine the power from the DC bus current and voltage, and the speed from the controller PWM setting (or a shaft sensor), and adjust PWM width and frequency based on motor characteristics such as slip and maximum breakdown torque, which may be stored in a table. If you know the VFD's efficiency, the DC power should determine the motor power and by knowing the speed, torque can be calculated. I have not actually built a VFD, so these are just assumptions, but I'm not sure how much additional performance can be tweaked out by complex multiphase measurements. Maybe I'll build one and give it a try!


----------



## PStechPaul (May 1, 2012)

Stiive said:


> Updated circuit. Thoughts?
> 
> How can I work out the time constant of that filter cap?
> 
> View attachment 13265


Here is a screenshot showing a 20 kHz PWM with 10% PWM (5 uSec), and the resulting signal (*100) to show how much the capacitor affects the waveform and accuracy. The original signal is 350V, so the voltage divider should show a 350/130 or 2.69V signal, or 269V on the graph. But you can see that it only reaches 107V. You can download the LTSpice file from:
http://www.enginuitysystems.com/pix/PWM_Filter.asc


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Since the motor lead voltages can go below GND, I think it is important to use +/- supplies on the op-amps. They may be able to tolerate inputs below the lower rail, but they cannot produce a negative output if they are single-ended. You can use a unipolar ADC such as those on a microntroller to read a bipolar signal by using an offset amplifier. Here is an example: http://masteringelectronicsdesign.com/design-a-bipolar-to-unipolar-converter/


I had this exact design a few days ago when I was still planning of using phase-phase, and offsetting by Vcc/2 to get the -400V to +400V spread scaled to 0-3.6V.
With my new version, I'm still not convinced I need to sense voltages below ground, besides I'm happy with my clamp setup. And if i was to get such a voltage, I wouldn't know what to do with it code wise! Id imagine if I got a reading below ground, it would only be due to noise, as I expect the voltages to be a few mV above ground. I'll look into my simulation further though to see in what (if any) cases it may occur.





PStechPaul said:


> But my original comment was about the required accuracy. I think it may only be necessary to read within 2% or 1%, which eliminates the 0.1% divider resistors and may allow 8 bit ADC readings which are faster for conversion time as well as processing, especially if you are using an 8 bit processor.


The more accurate the better, my whole code relies on these voltages. Any error propagates through to every estimation of my code. 

Besides, what downfall has a 0.1% resistor apart from the cost?



PStechPaul said:


> Have you determined the actual effect of reading error on the motor performance?


See my post a few days ago showing the error from using Vdc estimation of the 3-phase voltages. These are probably only mV apart and cause massive torque ripple. If anyone's interested, I can plot the error between Vdc estimation and 3-phase voltage sensor readings.



PStechPaul said:


> ISTM that the driver will apply adjustments of pedal position to get the speed and torque desired, and the motor controller only needs to keep the motor within safe operating limits.


The foot pedal controls torque in my case. The driver controls the torque request to the controller, and the controller tries to create that torque.



PStechPaul said:


> So you could just determine the power from the DC bus current and voltage, and the speed from the controller PWM setting (or a shaft sensor), and adjust PWM width and frequency based on motor characteristics such as slip and maximum breakdown torque, which may be stored in a table. If you know the VFD's efficiency, the DC power should determine the motor power and by knowing the speed, torque can be calculated.


What you are describing is a V/f controller. This is the simplest type of control. Yes it works, but is very primitive



PStechPaul said:


> I have not actually built a VFD, so these are just assumptions, but I'm not sure how much additional performance can be tweaked out by complex multiphase measurements. Maybe I'll build one and give it a try!


A LOT more performance, precision and efficiency. You can buy V/f controllers very cheap, but i wouldn't recommend for EV use, way too inefficient.

You should build a controller based on my schematic (once its released). From that you could implement V/hz, FOC, DTC, 6 step, most/any type of control you wanted.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Here is a screenshot showing a 20 kHz PWM with 10% PWM (5 uSec), and the resulting signal (*100) to show how much the capacitor affects the waveform and accuracy. The original signal is 350V, so the voltage divider should show a 350/130 or 2.69V signal, or 269V on the graph. But you can see that it only reaches 107V. You can download the LTSpice file from:
> http://www.enginuitysystems.com/pix/PWM_Filter.asc



Thanks mate, forgot I even had LTspice on my computer... much easier for smaller simulations like this than the other SPICE versions.
Had a play around, looks like I'm looking at < 0.5nF.

Might try my voltage clamp on this too


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> I have not seen this in my simulations, but then again I haven't particularly looked for it... maybe i'll extract my FWD from the IGBT module and place a current meter on it....
> I thought you were a motor terminal is only either VDC- or VDC+ kind of guy  I was the only one arguing that the phase could be above/below the rails. Did you see my sinusoidal error results of the phase voltages via DC bus approximation?


You caught me  I guess I was talking about to first approximation. You're always going to be either a diode drop below V- or above V+, or the saturation voltage of the IGBT the other way. You also have resistive losses in the motor leads and in the motor windings themselves. The thing is, you can characterize these things once and apply a correction factor in your algorithm.

I meant to ask, is the sinusoidal error in your estimation proportional to phase current? It may be due to, e.g., a misestimation of your winding resistance.

Is your model Delta or Wye?

I think it's neat you can model your system in such detail, but it's a bit hard to understand it from afar. 




Stiive said:


> I'm posting on here because I want people like you to give their thoughts. Don't worry about offending me, you've sparked me to do more research - this is a good thing.


Yeah, I just don't want to be an obnoxious internet know-it-all  Most of my experience with this subject so far has been theoretical, but I have educated myself a bit on inverter construction through the destruction of a few IGBT modules. Nothing like a small explosion to drive home lessons like minimizing bus inductance


----------



## PStechPaul (May 1, 2012)

The instrumentation amplifier is a differential amplifier which can work with high common mode voltages. If you want to read high voltages, as you do, you need to have equal voltage dividers on both the positive and negative inputs. Otherwise, the effect of the two voltages will be unequal. So, what I would suggest is two voltage dividers, and all of the resistors must be 0.1% or whatever precision you need. I found a nice instrumentation amplifier in the LTSpice library: http://cds.linear.com/docs/Datasheet/1102fb.pdf

They are a bit costly, but they are in stock at Digikey for about $9 each. These are high speed devices, and you will need that for measuring PWM widths as low as 2 uSec.

Here is the LTSpice circuit, showing the performance on a 10% PWM at 20 kHz:









You can also build a reasonably good differential amplifier using just a high speed op-amp.









It actually appears to be a lot better , although you might need to adjust for actual offset voltages to get a good zero reading. For that you can hang a pot across the +/- 5V supplies and run a 100k resistor to the 1k output resistor shown. That will give you about 1% adjustment.

This is available in a quad version LT1631 which is in stock at $12 but you can make four amplifiers so that's not bad at $3/amp. And you might get by with a slower less expensive op-amp like the LTC6257. 

The simulations will be left as an exercise for those who are interested. 

I have the ASC files for thiese and other simulations at:
http://www.enginuitysystems.com/pix/


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> The instrumentation amplifier is a differential amplifier which can work with high common mode voltages. If you want to read high voltages, as you do, you need to have equal voltage dividers on both the positive and negative inputs. Otherwise, the effect of the two voltages will be unequal. So, what I would suggest is two voltage dividers, and all of the resistors must be 0.1% or whatever precision you need. I found a nice instrumentation amplifier in the LTSpice library: http://cds.linear.com/docs/Datasheet/1102fb.pdf


Haha I was just running some simulations in LTSpice with that same amp. 

Problem is, I can't do the double voltage divider as you've done it because the "negative" is ground...
i.e. I'm reading the potential between phase voltage and ground


----------



## Stiive (Nov 22, 2008)

Might have to just go back to my original opamp design with offset.


----------



## PStechPaul (May 1, 2012)

It doesn't matter. If you run the simulation you can tie the (-) of the voltage divider to GND, or any other voltage within the CMRR of the differential amplifier. But you really should have an analog ground which is separated from power ground and earth ground and other points which are nominally at ground potential. But I think the most accurate measurement will be to put the three differential amplifiers across the motor leads. If you measure them at the middle of the PWM cycle they will still nominally be at Vbus(+) and Vbus(-), but you will very accurately be able to read the exact voltage on the motor winding at that time, which is what you want.

You also have the opportunity to read the other differential amplifiers which will read the open circuit voltage of the unpowered windings. AFAIK only two motor wires are powered at any given time. I'm not sure about that, but otherwise two of the motor windings would be connected together at either Vbus(+) or Vbus(-). I don't think that is the case except when the motor is off. Even when running at zero RPM the PWMs are 50% and I think they are timed such that the voltages across each winding are zero.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> It doesn't matter. If you run the simulation you can tie the (-) of the voltage divider to GND, or any other voltage within the CMRR of the differential amplifier.


Then that's essentially how it is now?.... Also, what about the offset in your new circuit?



PStechPaul said:


> But you really should have an analog ground which is separated from power ground and earth ground and other points which are nominally at ground potential.


Hmm, this would be hard because I was planning the power for the MCU to come from the DC bus, via a non-isolated buck converter.
If I scrapped that, could run an isolated DC-DC from 12V and keep it isolated. But then I would have to isolate the voltage readings, because i don't have access to the ADC refs on the demo board... The demo board is an extra few dollars and saves me a heap of room on my PCB, so i don't want to give it up easily 
My original plan was to have the LV system totally isolated, but isolation at the speed I need it was getting too costly/hard.



PStechPaul said:


> But I think the most accurate measurement will be to put the three differential amplifiers across the motor leads. If you measure them at the middle of the PWM cycle they will still nominally be at Vbus(+) and Vbus(-), but you will very accurately be able to read the exact voltage on the motor winding at that time, which is what you want.


To get the phase voltages from this I would have to assume the difference between DC+ and/or DC- was the same (half each). Don't really want to go down this road. Plus the readings would be less accurate as they could be VDC, 0VDC, or -VDC (double the spread).



PStechPaul said:


> You also have the opportunity to read the other differential amplifiers which will read the open circuit voltage of the unpowered windings. AFAIK only two motor wires are powered at any given time. I'm not sure about that, but otherwise two of the motor windings would be connected together at either Vbus(+) or Vbus(-). I don't think that is the case except when the motor is off. Even when running at zero RPM the PWMs are 50% and I think they are timed such that the voltages across each winding are zero.


There are no unpowered windings, except during dead time. Each phase is either DC+ or DC-.
DTC does not use PWM for control (except for DTC-SVPWM). I'm using discrete method.

Here is a decent paper I just googled on DTC-DSVM (what I'm using)
http://hal.archives-ouvertes.fr/docs/00/52/65/85/PDF/IREE_2009_KHOUCHA.pdf

This particular article uses approximations from Vdc (OKAY for smaller drives), and is sensitive to motor parameters.


----------



## PStechPaul (May 1, 2012)

The grounds do not need to be isolated. But they should be kept separate on the PCB and the wiring and connect together at a single point. I usually use a low value resistor, or even a wire jumper. Then that jumper can also be used as a common test point.

Thinking more about the operation of the PWM drive I realize that it must work as you said, with the windings always connected to one or the other side of the bus.

In my simulation, I use a PWM signal which goes to +300V and -4V, to simulate the effect of the IGBT drop and inductive load effect. 

The LT1630 has a typical offset voltage of 150 uV. Since the gain is so low, the output should have no more than that. Even at the maximum of 500uV, that is less than 0.02%. So no worry. 

Here is a simulation of a three phase PWM drive using a voltage to pulse width converter and 5kHz carrier. But using op-amps and 1k resistors for the load, and a +/- 2V drive. That would be about a 1.2 mW motor.


----------



## Stiive (Nov 22, 2008)

Here are some other results from the simulation.

Firstly, here is a closeup of the phase voltage (yellow) vs the sum of the DC bus * switch state. The skinnier pulses are 5e-6 wide, and i have sampled at 2e-7.








Here is the error in the phase from VDC estimation when sampling the Vdc*switch state 2e-7s before the next switch state is commanded. You can see the error between the estimation and the phase voltage is quite small (<0.5V), but it leads to a reasonable error in the torque and flux estimations









Here is the error in phase estimation when sampled 2e-7 after the switch state. Surprisingly the outcome isn't much different even though the error are huge. I think its just calculating the inverse state of the switches, as if the motor we spinning backward.









More reasons not to do VDC estimation, or measure phase-phase. Though as the Vabc errors are sinusoidal, if i can work out the zero crossing I could estimate the error in each of the phases.
Also, another reason why my V-phase readings need to be spot on... This 0.5V (0.15%) error will cause headaches in a high powered drive!  Oh ohh


----------



## PStechPaul (May 1, 2012)

I got think about this, and I really wonder what the voltage readings will really tell you. If you measure during a PWM on or off cycle, it will always read either the bus voltage or ground voltage, except for losses in the IGBTs or FWDs. The only other variable is the ripple on the DC supply, which ideally will be very small. 

If you measure directly across the motor phase leads, you will still get either bus voltage or ground, except for the total losses of the IGBTs and the motor wiring resistance. These are all quantities that should be minimized for best efficiency, and otherwise can be characterized by knowing the phase current and the bus voltage at the time of measurement.

The phase current that you read is a vector based on the position of the rotor at the time of measurement. If you know the rotor position very accurately, I think you can determine the actual vector phase current of the rotor and determine the torque. But this requires a precision shaft encoder to provide the angular position.

If you use sensorless control, I think you need to make some approximations based on known motor characteristics, so you lose some accuracy. Since the controller is providing the power for the rotating field, you always know what part of the sine wave is being approximated by the PWM signal, so you know what the rotor position should be if you know the actual motor speed, torque, and slip.

The most efficient drive for an induction motor, AIUI, would be pure sine waves. The PWM just adds harmonic content and losses due to capacitance and inductive effects. So, what about adding LC filters on each of the motor lead connections to remove the harmonic content? I think it would just involve a parallel resonant tank circuit tuned to the PWM frequency. Then you could measure the motor voltages and currents based on a (relatively) pure sine wave, which should give you more realistic measurements, as well as boosting efficiency.

Here is what I came up with. I have parallel resonant LC filters at the fundamental and third harmonic from the raw PWM, and then a series L and parallel C at the fundamental on the load resistor. The resultant sine wave looks very much like the original sine wave (red) that was used to derive the PWM. I don't know the practical limitations of such an approach, or the benefits, if any. It may require very large and expensive inductors and capacitors. But it sure is a pretty sine wave (blue), compared to the raw PWM (green)!










Any thoughts about this?


----------



## Hollie Maea (Dec 9, 2009)

Unless I am mistaken, the motor doesn't "care" about the voltage, but just about the current, since it is creating magnetic fields which arise from current. So the job of the PWM is to create a nice sinusoid for the current, even if the voltage producing it looks nasty. The motor is essentially a giant inductor, which is a low pass current filter, so the current through the motor doesn't contain that many high frequency harmonics in spite of the incoming square waves.


----------



## PStechPaul (May 1, 2012)

Hollie Maea said:


> Unless I am mistaken, the motor doesn't "care" about the voltage, but just about the current, since it is creating magnetic fields which arise from current. So the job of the PWM is to create a nice sinusoid for the current, even if the voltage producing it looks nasty. The motor is essentially a giant inductor, which is a low pass current filter, so the current through the motor doesn't contain that many high frequency harmonics in spite of the incoming square waves.


AFAIK the motor is only partially inductive, and less so as it approaches the ideal 1.00 power factor. There is also a relatively high parasitic capacitance caused by the many overlapping turns of wire with thin insulation, so high frequency harmonic content can cause high transient currents (and ringing transients) which can degrade the insulation over time. This is why there is a special class of motors designed for PWM use. If the transients can be reduced at the controller, it will be less stressful for the motor, and it can reduce audible noise. It might be sufficient to add a small inductor in series with each motor connection, and also perhaps a small capacitor, to soften the sharp edges of PWM transitions. It can also be done by slowing down the slew rate by adding resistance and capacitance to the IGBT gate drives, but this has a tremendous cost in reduced efficiency and wasted heat. The pure LC filters should not cause any significant heat since they essentially store and release the energy that might otherwise be wasted in a snubber or the IGBT.

Here are waveforms for just a series inductor of a 10.1 mH and a 1.0 uF capacitor. Both are fairly small inexpensive components for 600 VDC and 30A. The B and C phases have 101 mH and 0.1 uF. The resonant frequency is the same as the fundamental PWM of 5 kHz.


----------



## Stiive (Nov 22, 2008)

Shows how long it takes me to post. 2 other posts pop up... 
Haha


----------



## Stiive (Nov 22, 2008)

Haven't posted for awhile, been sick over the past few weeks... 
Good news though, got some goodies on their way, when they come might do that video explaining my work thus far. Maybe someone will find it vaguely interesting.

Thought i'd give a brief update on my (minimal) work over the past few weeks anyway.

Been playing around with my MATLAB model and have run into some problems.
I Opened a huge can of worms just by replacing the SimPowerSystems IGBT/Diode block with a IGBT and external diode. Now the IGBT and diode aren't modeled as ideal components and its making large estimation errors. Whats strange is, it seems to be the snubber on the individual switch blocks thats causing the problems. I can change all the other values (current fall time, tail time, forward voltages etc) and it doesn't seem to effect the results. The snubber resistance and capacitance however are the values that cause mayhem. The thing is, I wont even be having snubbers over the high and low IGBT switches (i.e between DC+ and phase, or DC- and phase). I only have snubber over DC+ and DC-.
So I modelled the snubber as the series capacitance of collector-gate and gate-emitter (miller capacitance) in parallel with collector-emittor capacitance, but for any value of resistance I get massive error propagation. 
Stupid SIMULINK wont let me remove the snubber across the high and low switches cus apparently the IGBT and/or diode is modeled as a current source or something 
Anyone good on SIMULINK SimPowerSystems (SimScape package), that has a good work around?

Maybe i'll just go back to the ideal IGBT/Diode block as the other parameters don't seem to effect my integration. Apart from that, got some dead time compensation and advanced Vdc approximation working decently. Vdc approximation relies heavily on the temperature of the IGBTs though which will be interesting in real life :s

PCB and hardware schematics are coming along too, been adding in a heap of backup circuits and features for the future. Might even make the board compatible to run FOC to make comparisons, will only require a few changes/considerations.


Anyway, back to it i guess. Gahh. 
Not the most rewarding project i've undertaken thus far... Hopefully when the motors spins it'll all be worth it.


----------



## stickytechnology (Sep 19, 2010)

Hi Stiive,

I'm afraid I can only give moral support, as I've never used that tool, but glad to hear you're soldiering on.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hi Stiive,
> 
> I'm afraid I can only give moral support, as I've never used that tool, but glad to hear you're soldiering on.


Haha thanks Sticky... 
How's your controller going btw? Do you have a youtube video or something of it?


----------



## PStechPaul (May 1, 2012)

I'm not really familiar with MATLAB or Simulink, but I don't understand how either can be used to simulate electronic components. Have you used a simulator such as LTSpice? It has many models for real components and accepts SPICE models from various manufacturers for MOSFETs, IGBTs, inductors, and ICs. However, I don't know if it can model motors or software-based components such as microcontrollers.

I have found it most helpful for portions of circuits but it can simulate a three phase PWM motor drive, at least conceptually, as I have shown previously. I hope you are on the right track and come up with a good product.

BTW, why do you have a snubber from B+ to B-? That should be pretty much pure DC, especially if it is properly bypassed with a combination of large electrolytics and smaller, low ESR film capacitors. The bus in the controller should also be isolated from the battery pack source with a small inductor. And all components should have at least the most prevalent parasitic elements, such as ESR.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I'm not really familiar with MATLAB or Simulink, but I don't understand how either can be used to simulate electronic components. Have you used a simulator such as LTSpice? It has many models for real components and accepts SPICE models from various manufacturers for MOSFETs, IGBTs, inductors, and ICs. However, I don't know if it can model motors or software-based components such as microcontrollers.


Yeh i have used LTSpice and SPICE but i think MATLAB is pretty much industry standard. Most academic papers on motor control use MATLAB too which is good for translating new theories into my model.



PStechPaul said:


> I have found it most helpful for portions of circuits but it can simulate a three phase PWM motor drive, at least conceptually, as I have shown previously. I hope you are on the right track and come up with a good product.


Yeh i use SPICE still for odd bits and pieces, MATLAB has a great motor simulator in it though so i think i'll stay with that. Just this stupid problem atm



PStechPaul said:


> BTW, why do you have a snubber from B+ to B-? That should be pretty much pure DC, especially if it is properly bypassed with a combination of large electrolytics and smaller, low ESR film capacitors. The bus in the controller should also be isolated from the battery pack source with a small inductor. And all components should have at least the most prevalent parasitic elements, such as ESR.


I am using a DC link capacitor module that is designed for the Semikron IGBT module. It has large film caps and snubbers in it. The few controllers I have seen stripped had snubbers over the rails.

I have never seen snubbers over the phase and the DC bus rails before though, is this common? This would be hard to implement on the brick I will be using considering the dimensions.


----------



## PStechPaul (May 1, 2012)

I don't really have much direct experience with VFDs but snubbers are generally series RC networks which are used to limit the voltage of an inductive "kick" when an inductor is switched off while current is still flowing. The idea AAUI is to use a resistor of low enough value that the current in the inductor at the time of switching will create a voltage within the breakdown rating of the semiconductor, so for instance if 100 amps is flowing a 6 ohm resistor will limit the transient to 600 volts. The capacitor is chosen so that the normal switching frequency and voltage will not create too much power dissipation. So at a 20 kHz PWM frequency and a 400 volt bus, a 0.0047 uF capacitor will present a reactance of 1.69 kOhms and a current of 118 mA and power loss of 83 mW. The effectiveness of the snubber depends on the rise time of the transient which is normally expected to be very fast, in the order of microseconds or nanoseconds. The energy is 0.5*I^2*L. But I have found that these calculations are mostly a starting point and the actual value must be determined by good simulation and/or actual bench testing.

Here are some articles about snubbers in IGBT VF drives. I think they are a good idea and should not hurt anything. They may be useful mostly to reduce transients caused by lead inductance and not the motor itself. And the one article shows small inductors on the top IGBTs which may help reduce cross-conduction current spikes which can destroy the IGBTs or cause large transient voltage drops in the DC bus (as one of your scope shots seems to show).

http://www.cde.com/tech/design.pdf
http://eprints.iisc.ernet.in/3969/1/a_high.pdf (from 1999)
http://www.onsemi.com/pub_link/Collateral/AN1048-D.PDF (for thyristors)
http://www.pwrx.com/pwrx/app/rapid_design_kits_for_three_phase_motor_drives.pdf
www.allegromicro.com/~/media/Files/Sanken/Datasheets/SCM-1103M-Datasheet.ashx
http://ir.lib.ncut.edu.tw/bitstream...hing Inverter for Induction Motor Drives,.pdf
http://www.ti.com/lit/ds/symlink/drv8312.pdf
http://itee.uq.edu.au/~aupec/aupec99/li99.pdf

I even found this example from MATLAB/Simulink:
http://www.mathworks.com/help/toolbox/physmod/powersys/ug/f1-6641.html

Not all of these may be applicable to your project, but some of them were interesting and may contain some useful information, for you or others. I don't really understand the principles in the paper you cited a while back, and it seems a bit different from what I envision, especially where the PWM frequency is not established. But I think it may be that the frequency is actually established by the rotation of the motor, since the controlling quantity is torque. Obviously the driving frequency and phase angle in reference to the position of the rotor must have a specific relationship to the motor speed, and will generally be faster by an amount determined by the motor characteristics and slip. It's just a different point of reference.

It's sort of like commanding from the front and expecting the troops to follow, or getting behind them and kicking their ass when they don't keep moving.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I don't really have much direct experience with VFDs but snubbers are generally series RC networks which are used to limit the voltage of an inductive "kick" when an inductor is switched off while current is still flowing. The idea AAUI is to use a resistor of low enough value that the current in the inductor at the time of switching will create a voltage within the breakdown rating of the semiconductor, so for instance if 100 amps is flowing a 6 ohm resistor will limit the transient to 600 volts. The capacitor is chosen so that the normal switching frequency and voltage will not create too much power dissipation. So at a 20 kHz PWM frequency and a 400 volt bus, a 0.0047 uF capacitor will present a reactance of 1.69 kOhms and a current of 118 mA and power loss of 83 mW. The effectiveness of the snubber depends on the rise time of the transient which is normally expected to be very fast, in the order of microseconds or nanoseconds. The energy is 0.5*I^2*L. But I have found that these calculations are mostly a starting point and the actual value must be determined by good simulation and/or actual bench testing.
> 
> Here are some articles about snubbers in IGBT VF drives. I think they are a good idea and should not hurt anything. They may be useful mostly to reduce transients caused by lead inductance and not the motor itself. And the one article shows small inductors on the top IGBTs which may help reduce cross-conduction current spikes which can destroy the IGBTs or cause large transient voltage drops in the DC bus (as one of your scope shots seems to show).
> 
> ...


Lol, you must trawl google, you always come up with a bunch of articles and links 

I know what a snubber is used for, and IMO it still required over the DC bus because you can still get large spikes coming through the FWD, i just haven't seen it implemented between phase and rails. I'm hoping I can control the spikes via proper sizing of the gate resistors, but that's a bit hit and miss. 
I'll have to look into this some more I think.


----------



## PStechPaul (May 1, 2012)

Actually, I use www.dogpile.com, which uses various search engines. I like to search for information, and even when the results are not exactly what I'm looking for, sometimes they can be very interesting. 

You can also look at the schematics for Microchip's high voltage motor control demo board. An early design used their PIC18F2331 series, and an IRAMS module which runs up to 2 HP motors. I did not see any snubbers at the motor leads, and on some designs I saw a snubber across the bus along with bypass capacitors. But I really can't see how a properly bypassed DC bus can have voltage transients large enough and fast enough to require snubbers. Especially if the dI/dt of the IGBTs is limited by the use of high-side inductors and/or motor lead inductors. Some very high current transients might be caused by distributed capacitance in the motor leads and windings, so small inductors or even ferrite beads might make the controller and the motor happier and not fight each other. 

I don't particularly like to absorb transients in the IGBTs or MOSFETs by slowing the gate drive. If so, it is the fall time that needs to be increased for a softer turn-off and less transient, but care is needed not to extend past the deadband and get cross-conduction. A snubber is pretty simple and cheap,and you can tell if it's working by touching the resistor. 

A fast turn-on could cause a high current spike if there is capacitance at the motor leads. The magnitude of this surge should be limited by a high-side inductor or one at the motor lead. Again, I prefer that method to slowing down the IGBT and risking higher internal dissipation. In my simulations I have found that I get very high short-duration power in the 10kW range if the MOSFET goes through its linear range where it can see almost full bus voltage and load current simultaneously. At 400V and 100A, there is the potential for 40kW. Some devices may exhibit second breakdown or progressive deterioration because this power may be concentrated in a tiny area of the junction.

I don't see how the FWDs can cause large current transients which would cause bus voltage spikes. It seems that they should only conduct the same current as was flowing when the IGBT turned off. If it does not conduct fast enough, there will be a voltage transient, but it should be localized around the motor lead connection where the inductance is.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Actually, I use www.dogpile.com, which uses various search engines. I like to search for information, and even when the results are not exactly what I'm looking for, sometimes they can be very interesting.
> 
> You can also look at the schematics for Microchip's high voltage motor control demo board. An early design used their PIC18F2331 series, and an IRAMS module which runs up to 2 HP motors. I did not see any snubbers at the motor leads, and on some designs I saw a snubber across the bus along with bypass capacitors. But I really can't see how a properly bypassed DC bus can have voltage transients large enough and fast enough to require snubbers. Especially if the dI/dt of the IGBTs is limited by the use of high-side inductors and/or motor lead inductors. Some very high current transients might be caused by distributed capacitance in the motor leads and windings, so small inductors or even ferrite beads might make the controller and the motor happier and not fight each other.


In your first article (http://www.cde.com/tech/design.pdf) figure 18d on the third last page shows a snubber that connects to the phase as well. The other snubbers just go accross the DC+ and DC-. For the DC+ to DC- snubber, it states :


RANDOM ARTICLE said:


> "This snubber operates on the same principles as the de-coulping capacitor, but only during turn-off switching. As the IGBT turns off, energy trapped in the loop inductance is transferred to the capacitor.The diode blocks oscillations and the excess charge on the capacitor is dissipated through the external resistor."


It also says the snubber across the phase is only required in "higher current applications".... Hmm, reckon 600A is high amp?



PStechPaul said:


> I don't particularly like to absorb transients in the IGBTs or MOSFETs by slowing the gate drive. If so, it is the fall time that needs to be increased for a softer turn-off and less transient, but care is needed not to extend past the deadband and get cross-conduction. A snubber is pretty simple and cheap,and you can tell if it's working by touching the resistor.


Yeh an increased turn-off time reduces the inductive peak overvoltage, and increasing the turn-on time will reduce the peak current of the FWD.

Hmm more research required.... but if my model is anything to go from, a snubber on the phase messes with my control code severely!! Maybe it just needs a good tweaking


----------



## Stiive (Nov 22, 2008)

Stiive said:


> In your first article (http://www.cde.com/tech/design.pdf) figure 18d on the third last page shows a snubber that connects to the phase as well. The other snubbers just go accross the DC+ and DC-. For the DC+ to DC- snubber, it states :
> 
> It also says the snubber across the phase is only required in "higher current applications".... Hmm, reckon 600A is high amp?
> 
> ...



Spoke with Semikron... Snubber across the AC is not recommended for my IGBT/Application.
Suits me


----------



## Stiive (Nov 22, 2008)

Ugh, there's been a delay on my IGBT modules just as I finally got around to doing some more work on this project too, gahh...

So, since I've got 15*650V 75A (150A peak) IGBT and opto gate drivers sitting around, thought id do an interim solution so I can start doing some testing of the code. Good chance also to test out some different circuitry variations i have some up with. I've had enough of theory, i just want to send this PCB off ASAP and get into the nitty gritty 

Haven't been doing much research on gate drivers though because I'm getting off-the-shelf Semikron whizzbang modules.
Since i'm trying to save money on this small inverter, thought i'd try just get away with just the basics -> NO Vcesat monitoring/UV/OV etc protection  (ahwel i've got 9 spare IGBT/drivers).

Bit concerned about the power required for the switching though. I currently have 3W +-15V (@100mA) 3kV isolated DC-DC converters for each of the top IGBTs. And one big 15W +-15V 3kV servicing the bottom 3 IGBTs and some of the other components.

Considering the FOD3184 only outputs 3A, the minimum gate resistor I can use is 5R. However the average gate current is only I_G=Q_G*f_sw. 
Since the gate charge is only 578nC, for 100mA I guess I'm limited to 173kHz switching freq and a big cap to soak up the peaks. Sounds fine, however it's a bit hard to work out the switching freq of DTC. Generally its defined as (Number of switches per second / fundamental freq). The controller however issues a new switch state (which may be identical to the last switch state) every 5uS, so theoretically you could end up with 200000 switches in a second (though unlikely). It seems like this figure is more relevant to average gate current, as it defines how many times the gate drive has to pulse? Thoughts? Bit different to PWM.


Anyway, reckon my 3W power supplies are adequate for the gate drives? How big should my cap be? The bloody DC-DC spec sheet doesn't list a max output capacitance figure, and i don't want to overload it or make it unstable. I might have to email the manufacturer, or swap components - i only chose this one cus it was cheapest 

Would appreciate some input so I can smash this board out and send it off  I can post pics of the inverter stage so far if it helps.


----------



## PStechPaul (May 1, 2012)

I don't understand the DTC algorithm, although I think the 5 uSec switch state is just a software loop possibly limited by the ADC rate and processing power. But ISTM 200,000 switches per second would cause nearly instant overheating and destruction of the IGBTs, as well as nasty inductive transients and other problems, so there should be some way to limit the actual drive to about 20kHz or whatever the IGBTs can handle. Then you will need to look at the gate drive and see what effect the transitions have on the power dissipation. I posted a long list of links on IGBT drive principles and bus design, which I think was the new thread on the DIY IGBT drive that had blown the IGBTs. But the best seemed to be:
http://www.evbmw.com/igbt.pdf (8 meg PDF)
and also
http://www.irf.com/technical-info/designtp/dt04-4.pdf
http://www.irf.com/technical-info/appnotes/an-944.pdf

I suppose I'll need to review the articles I have on DTC, but I think it would be easy enough to implement on a standard PWM drive. It might even be possible to implement in hardware. You may have seen my simulation of a PWM drive:










The hard part is generating the three phase sine wave used as the reference (V1, V5, V6). But this can be done with a VCO, binary counter, and three sine table EPROMs and a triple multiplying DAC. It also requires a triangle ramp wave (V4) which could be generated from another EPROM and DAC, and is based on the carrier frequency of the VCO rather than the output frequency. The comparators generate the actual PWM drive. 

Now the only two controls you have are the amplitude and frequency. For basic speed control, you would just use the normal V/F constant and adjust the frequency with the VCO. But you would also have a torque limit which could be derived from the DC bus current. If it exceeds the design limits, the frequency (and voltage) whould be adjusted back, using a PID loop.

For DTC, you would apply a control signal for torque (bus current) and adjust the V/F in order to achieve that. Of course you would need to have a limit, which could be based on maimum torque (current) for the motor, at which point the drive would remain constant. The frequency would then adjust only as needed to maintain the desired torque. 

Maybe I've just redefine the standard DTC algorithm in different terms. But I don't understand why the carrier frequency would change. However, I can also see that in my example the carrier frequency would change with frequency. Maybe that's a good thing. At low speeds, a low carrier frequency would have less losses due to switching. But a variable carrier frequency might also have objectionable audible noise and would cause saturation of the windings at low speed. 

There may be some logic to using a lower carrier frequency at higher speeds. It may result in a coarser PWM, eventually becoming essentially a stepped DC waveform where carrier frequency equals the output frequency, but that may be the most efficient at such speeds, and it will allow the highest actual drive speed based on the capability of the IGBT. So you could actually have a 20 kHz drive! 

I wonder if it is good to have the PWM carrier as an integer multiple of drive frequency? It would mean that the PWM would be identical for positive and negative output excursions. Otherwise there will be what might be termed a sub-carrier or sideband of low frequency based on the average value of the PWM pulses, and the peaks will have somewhat different pulse widths. Hmmm. 

Well, I might not really know what I'm talking about, and it might just be my own "intuitive" way of trying to understand a concept that may be better described by mathematics. Hopefully it helps a little...


----------



## subcooledheatpump (Mar 5, 2012)

Stiive, Have you considered using an intelligent power module? (or smart power modules, whichever)

They have integrated gate drivers, plus built in over current and over temperature protection, as well as UV lockout for the gate drivers. 

I'm excited to see progress on this project. I'd like to have a torque mode controller for my van, since regular speed mode is a bit crazy, and SVM DTC controllers are expensive.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I don't understand the DTC algorithm, although I think the 5 uSec switch state is just a software loop possibly limited by the ADC rate and processing power.


Pretty well... The code is all written by me and i can chose to change the sample time to whatever i like.



PStechPaul said:


> But ISTM 200,000 switches per second would cause nearly instant overheating and destruction of the IGBTs, as well as nasty inductive transients and other problems, so there should be some way to limit the actual drive to about 20kHz or whatever the IGBTs can handle.


Yeh, that's why i'm a bit scared, though 5uS sample is pretty standard for high-speed high-powered DTC drives. Again the actual switching frequency by definition would then be 200,000 / fundamental freq. Say for a 60Hz AC wave, this would represent 3.33kHz switching frequency, which is perfectly fine. But by that same formula, a 10khz carrier PWM drive at 60Hz would need 600,000 pulses per second. Hmm now I cant seem to find that formula again, do these values seem right?



PStechPaul said:


> Maybe I've just redefine the standard DTC algorithm in different terms. But I don't understand why the carrier frequency would change.


Lol, for the last time - DTC does NOT use PWM and therefore does not have a carrier frequency as such. 
The closest match to PWM would be delta modulation where the torque and flux hysteresis act as the carrier that determines when to switch. The torque/flux do not have a set frequency, are not linear/sinusoidal/parabolic/etc and can rise/fall at rates determined by MANY factors; therefore there is no set frequency to basic DTC.

It seems what you keep describing is a V/hz control that is controlled by torque commands. There are quite a few reasons why this is less than ideal, vector control is much better


----------



## Stiive (Nov 22, 2008)

subcooledheatpump said:


> Stiive, Have you considered using an intelligent power module? (or smart power modules, whichever)
> 
> They have integrated gate drivers, plus built in over current and over temperature protection, as well as UV lockout for the gate drivers.
> 
> I'm excited to see progress on this project. I'd like to have a torque mode controller for my van, since regular speed mode is a bit crazy, and SVM DTC controllers are expensive.


Yeh, i'm using 3 for the large inverter, but their also delayed with the IGBT modules.
For this small interim inverter, i'm trying to get a cheaper alternative happening... Unless there is a good driver unit you can recommend for <~$30 per IGBT? 

The components i have are Fairchild FGH75T65UPD IGBTs and FOD3184 opto drivers. I have 15 of each so i can afford to blow up a few  Main question is, is 3W (1.5W on / 1.5W off) enough to drive these at the switching required? Don't want to spend hours debugging to find out that its only switching 80% of the time or something.


----------



## PStechPaul (May 1, 2012)

The power is needed only for charging and discharging the gate capacitance, and if you have a big capacitor on the output of the gate supplies, it will supply the current. The power of each transition is something like 

P = 0.5*Vg^2*Cg/Tsw, 

so at 15V and 50nF and 1uSec, this is 5.625W. 

At 20kHz (50 uSec) with two transitions per cycle this is 5.625*2/50 or 0.225W.

So your 3W supplies look good. But if you actually switch at the 5 uSec rate this will be 2.25W and your close to the rating.

According to http://www.pwrx.com/pwrx/app/PCIM99.pdf the gate charge of a large IGBT module can be in the order of 8500 nC, and drive power is:

P = 8500nC * 20kHz * 15V = 2.55W

So you may exceed the power supply rating if your effective switch in frequency is much higher or if your gate charge is higher. I don't think the power is affected by the series gate resistor, but it might be.

Since the load is mostly capacitive, it might be possible to design a gate driver which transfers much of the energy back and forth, but this would involve some serious design work while a larger power supply is easy and cheap. The low side IGBTs are easy, and you can just use a single switching supply or a non-isolated buck converter from the DC link. 

The high side needs to be isolated, but you might be able to use a very simple design using a square wave chopper across the DC link and three small linear supplies using ordinary 5W transformers, rectifiers, and capacitors.

But I think you will need to avoid switching the IGBTs any faster than 20kHz. The pulse widths can be as narrow as 5uSec, but the duty cycle must be such that you have at least 50uSec between pulses. This would be an equivalent carrier frequency of 20kHz for a fixed frequency PWM.

BTW, the data sheet for your IGBTs http://www.fairchildsemi.com/ds/FG/FGH75T65UPD.pdf indicate that they can be used up to 100kHz with about 50% derating, and the gate charge is less than 600nC, so you're good. Here's the data sheet for the driver: http://www.fairchildsemi.com/ds/FO/FOD3184.pdf. Also looks good.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> But I think you will need to avoid switching the IGBTs any faster than 20kHz.


Well, only 1 way to find out... I'm just gonna go with my design and hope for the best. 
Hopefully my formula for switching freq is correct, and then I will be fine - using this formula my code never goes above ~16khz even when switching every 5uS


----------



## stickytechnology (Sep 19, 2010)

Hi Stiive,

Been I while since I checked this thread. Glad you're moving forward. My opinion on the switching rate is that 40kHz is an often-quoted sweet spot for the switching loop. You can run your estimators as fast as you want, but there's no reason to switch faster than 40kHz because the flux vector just can't move that fast. Put another way, if your tolerance band is that narrow maybe your torque ripple requirements are too stringent.

My own inverter is still mothballed because of work and family, but I enjoy seeing others make progress


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hi Stiive,
> Been I while since I checked this thread. Glad you're moving forward.


Hey Sticky... welcome back 



stickytechnology said:


> My opinion on the switching rate is that 40kHz is an often-quoted sweet spot for the switching loop.


As in switching frequency = 40kHz? How do you work this out?



stickytechnology said:


> You can run your estimators as fast as you want, but there's no reason to switch faster than 40kHz because the flux vector just can't move that fast.


Guess this depends on the motor, the little 2kW IM i'll first be testing on wont be able to change quickly due to high inductance and resistance. Some of the motors ill be 'graduating' onto have minimal inductance <50uH and very low resistance that you get massive currents for even the smallest voltages applied (pretty much a short circuit). Not looking forward to this 



stickytechnology said:


> Put another way, if your tolerance band is that narrow maybe your torque ripple requirements are too stringent.


Yeh, my hysteresis band is very small, increasing it should decrease the switching freq considerably. Still not entirely sure if the formula i'm using to work out switching freq is correct, i gave up on it for now cus making the thing is more important.




stickytechnology said:


> My own inverter is still mothballed because of work and family, but I enjoy seeing others make progress


Get on it! I need a DTC buddy. 
I'm just finalising my PCB design as we speak, think i might order all of my components first and check the footprints before I send it off for manufacture.On this small board I'm making now I'm putting a small VSI with TO-247 IGBTs + heatsinks on it and its making the board massive, so now the PCB costing me more than i'd hoped - so i don't want to screw it up! Still trying to make it modular so i can cut off the small VSI stage is required and drive some Fuji 600V 600A units i have lying about.

It's now cheaper to buy 10 from China than 1 from Batch PCB. Anyone want a ~20kW DTC controller?


----------



## PStechPaul (May 1, 2012)

Stiive said:


> I'm just finalising my PCB design as we speak, think i might order all of my components first and check the footprints before I send it off for manufacture.On this small board I'm making now I'm putting a small VSI with TO-247 IGBTs + heatsinks on it and its making the board massive, so now the PCB costing me more than i'd hoped - so i don't want to screw it up! Still trying to make it modular so i can cut off the small VSI stage is required and drive some Fuji 600V 600A units i have lying about.
> 
> It's now cheaper to buy 10 from China than 1 from Batch PCB. Anyone want a ~20kW DTC controller?


I might be interested, depending on the design and the cost and any issues shipping it from Oz to the US. I've used www.pcbcart.com in China and they do a good job. But I've gotten better prces for small quantities from www.pcbfabexpress.com. and most recently www.zoompcb.com. If you contact them, ask for Melody and tell her Paul at P S Technology sent you. I got 3 pieces of a 6" x 12" PCB, actually containing four smaller designs to be cut and separated, for a total of $178. Here is the drill drawing:










Could you send me a schematic and PCB layout? What software do you use? I am using Mentor Graphics PADS, and I usually use the PADS2004sp2 version but I also have version 9.x. I'd be happy to look at the design and offer any suggestions or point out anything I think might be a problem. It's always good to have another set of eyes and someone with a different set of experiences to achieve the best results.

Good luck!


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> As in switching frequency = 40kHz? How do you work this out?


The ones I've seen appear to fix the control loop at 40Khz. It's a deterministic calculation, so you always know how long it will take to read the ADCs, update the estimators, look up the switch table, and switch. As you pointed out, you don't alway need to switch, and sometimes you're only switching one half bridge instead of 2, so from the switch's point of view, the fastest rate is never more than 2/3 * 40kHz, and usually less. 



Stiive said:


> Guess this depends on the motor, the little 2kW IM i'll first be testing on wont be able to change quickly due to high inductance and resistance. Some of the motors ill be 'graduating' onto have minimal inductance <50uH and very low resistance that you get massive currents for even the smallest voltages applied (pretty much a short circuit). Not looking forward to this


what is this beast?? a 30kW motor rewound with welding cable?? Pictures, please  I understand your constraints a bit better, now, especially why you care about differences of a fraction of a volt at the phase leads.




Stiive said:


> Get on it! I need a DTC buddy.
> I'm just finalising my PCB design as we speak, think i might order all of my components first and check the footprints before I send it off for manufacture.On this small board I'm making now I'm putting a small VSI with TO-247 IGBTs + heatsinks on it and its making the board massive, so now the PCB costing me more than i'd hoped - so i don't want to screw it up! Still trying to make it modular so i can cut off the small VSI stage is required and drive some Fuji 600V 600A units i have lying about.
> 
> It's now cheaper to buy 10 from China than 1 from Batch PCB. Anyone want a ~20kW DTC controller?


What's the overall footprint? I might be interested in a sample


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> I got 3 pieces of a 6" x 12" PCB, actually containing four smaller designs to be cut and separated, for a total of $178.


Still that's $60 a board, but I guess its a pretty big board - mines almost that size. I use Altium, PM me your email address


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> The ones I've seen appear to fix the control loop at 40Khz. It's a deterministic calculation, so you always know how long it will take to read the ADCs, update the estimators, look up the switch table, and switch. As you pointed out, you don't alway need to switch, and sometimes you're only switching one half bridge instead of 2, so from the switch's point of view, the fastest rate is never more than 2/3 * 40kHz, and usually less.


So you mean 25uS control loop sample time? I'm designing everything for 5uS which i guess it 200khz, again because of the big motor I end up planning to use.
I'm still not sure if the switching frequency is then a relationship of fundamental frequency - haven't done any more research/thinking about it.




stickytechnology said:


> what is this beast?? a 30kW motor rewound with welding cable?? Pictures, please  I understand your constraints a bit better, now, especially why you care about differences of a fraction of a volt at the phase leads.


Haha, I think you'll find most compact high powered EV induction motors have very very low inductance and resistance. We have a 60kW IM from EVE which we had to rewind because the inductance was too low for the Tritium WaveSculpter controller. Ive actually still got a phase winding of the removed old copper. But yes, this puts massive design constraints on the controller - I've spent a small fortune on extra _extra _precision parts.

The controller I'm designing now was intended to be just a test board to test some of the code for the big module to come, however its ended up pretty similar apart from slightly less functionality, cheaper gate-driving circuits and more compatible with various VSIs.
The next version is designed specifically for the Semikron 900A SKiM909 IGBT brick, primarily i guess due to the pressure contact setup required.





stickytechnology said:


> What's the overall footprint? I might be interested in a sample


So far 200*200mm. But i have a few other circuits on there such as a bunch of isolation (USB/CAN/USART) that don't need to be populated depending on the HV source (i'm testing from rectified 3-phase mains and powering LV and diagnosing with single-phase power). Also I'm designing the VSI completely modular at the end of the board, so it can either be chopped off or just remain unpopulated. Some of the isolation can be chopped off as well to make the board smaller as its on the extremes and the USB for example, is also modular and designed to be a separated.


Anyway, ill post some design pics up once I've done some more work on it. I'll have to scrap my previous PCB layout because i've modified the schematic so much in the past 12 hours haha. FWIW, I hate electronics 

So far its not exactly cheap, upto about $500 to populate NOT including the IGBTs/gate drivers which for the 650V 75A (150A peak) IGBTs i'll be using add another $100. Prob better off using some second hand IGBT bricks off eBay, but i had a bunch of these TO-247's lying around.

Well actually it would be cheaper if not for the colour LCD touch screen i'm using atm for control and visual feedback


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> So you mean 25uS control loop sample time? I'm designing everything for 5uS which i guess it 200khz, again because of the big motor I end up planning to use.
> I'm still not sure if the switching frequency is then a relationship of fundamental frequency - haven't done any more research/thinking about it.


Yeah, 25uS control loop cycle time, but much shorter ADC times, with possible oversampling. That's what I'm shooting for, but I'm only running a 75MHz clock and don't have such difficult requirements as you. I'm just hoping to tool around town, not go racing 



Stiive said:


> Haha, I think you'll find most compact high powered EV induction motors have very very low inductance and resistance. We have a 60kW IM from EVE which we had to rewind because the inductance was too low for the Tritium WaveSculpter controller. Ive actually still got a phase winding of the removed old copper. But yes, this puts massive design constraints on the controller - I've spent a small fortune on extra _extra _precision parts.


Yeah, you're pretty much off the map as far as the stuff I've played with/ thought about. At the bottom, it appears you have two opposing constraints- on the one hand, you need to switch fast to keep ahead of your flux vector, but on the other, you're switching high currents which is just plain slow. Seems like you almost want a preconverter that adjusts the bus voltage to a range that lets you switch the main bridge slower. You could then change bus voltage dynamically to suit the running speed. Kind of the opposite of PSTechPaul's setup. I think you'd gain back the losses in your buck converter through less switching loss in your main inverter.



Stiive said:


> So far 200*200mm. But i have a few other circuits on there such as a bunch of isolation (USB/CAN/USART) that don't need to be populated depending on the HV source (i'm testing from rectified 3-phase mains and powering LV and diagnosing with single-phase power). Also I'm designing the VSI completely modular at the end of the board, so it can either be chopped off or just remain unpopulated. Some of the isolation can be chopped off as well to make the board smaller as its on the extremes and the USB for example, is also modular and designed to be a separated.
> 
> 
> Anyway, ill post some design pics up once I've done some more work on it. I'll have to scrap my previous PCB layout because i've modified the schematic so much in the past 12 hours haha. FWIW, I hate electronics
> ...


Sounds cool, but I'm going the modular route, with a logic/ADC stage, a gate driver stage, and a power stage, all in a wedding cake like a traditional motor drive. Makes boards cheaper, and give some EMI benefit, but there is quite a bit of cabling.

BTW, How many layers in your board?


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Yeah, you're pretty much off the map as far as the stuff I've played with/ thought about. At the bottom, it appears you have two opposing constraints- on the one hand, you need to switch fast to keep ahead of your flux vector, but on the other, you're switching high currents which is just plain slow. Seems like you almost want a preconverter that adjusts the bus voltage to a range that lets you switch the main bridge slower. You could then change bus voltage dynamically to suit the running speed. Kind of the opposite of PSTechPaul's setup. I think you'd gain back the losses in your buck converter through less switching loss in your main inverter.


Yeh interesting thought. Probably will just add extra complexities at the moment. If control becomes a struggle, guess ill have to revisit this idea.



stickytechnology said:


> Sounds cool, but I'm going the modular route, with a logic/ADC stage, a gate driver stage, and a power stage, all in a wedding cake like a traditional motor drive. Makes boards cheaper, and give some EMI benefit, but there is quite a bit of cabling.


Yeh pretty much what my board is achieving, but its cheaper to put it through as one board with edge guarding and chop it up later. 




stickytechnology said:


> BTW, How many layers in your board?


Just 2, id love a smaller 4 layer board, but i think ill have to make that a later revision once all the bugs are weeded out due to the massive cost difference.


----------



## stickytechnology (Sep 19, 2010)

Yeah, I went with 2 layers on mine too, but it involved some gyrations in routing, because I wanted to reserve the bottom layer for a more or less continuous ground plane. My plan is to move to 4 layers for lower noise once the design is proven out. BTW, 4pcb.com here in the US do a $33 deal on two layer boards if you buy 4. They also have a 4 layer deal for $66. They are a good quality shop, but I'm not sure it makes sense for you with shipping and duty added in.

I'd also be happy to look over your schematic / layout if you want. I don't have altium, but I can read gerbers, and it looks like altium has a free viewer.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Yeah, I went with 2 layers on mine too, but it involved some gyrations in routing, because I wanted to reserve the bottom layer for a more or less continuous ground plane. My plan is to move to 4 layers for lower noise once the design is proven out.


Yeh, I have the same strategy, haven't chopped up my ground plane too much yet though, but i had only routed modules before I started to change everything (see below).




stickytechnology said:


> BTW, 4pcb.com here in the US do a $33 deal on two layer boards if you buy 4. They also have a 4 layer deal for $66. They are a good quality shop, but I'm not sure it makes sense for you with shipping and duty added in.


Yeh that's not too bad. 60sq inches is roughly my 200*200.



stickytechnology said:


> I'd also be happy to look over your schematic / layout if you want. I don't have altium, but I can read gerbers, and it looks like altium has a free viewer.


I'm actually chopping and changing everything AGAIN. ATM I'm removing the power stage completely from the board and will prob end up making a home PCB job on this, it's large traces with big spacing due to the voltage. Was gonna request no silkscreen anyway so I can lay CNC'd copper plates on-top to get my 75A. This is going to make the board smaller are more suitable to applications with other power stages.

Also thinking about making the whole board more similar to my next version, and contemplating getting rid of the DISCOVERY demo board in lieu for just the chip, but i think the modularity would be good for when I inevitably let the smoke out of at-least a few pins.
Either way, i just need to get this done, this was meant to be an interim test board, don't want to put too much thought/time into it.
I'll post pics when I'm closer to finishing it, but I've been too distracted by old mate beer lately and progress is slow


----------



## Stiive (Nov 22, 2008)

Just ordered >$500 worth of "controller parts" from digikey


----------



## Stiive (Nov 22, 2008)

Quick update.
Still alive, still making changes to the board.... gahh. 2 steps forward, 10 back. This time swapping out the 3A gate drivers for 14A beasts  Trying to future proof my needs a little bit.

Also lost about half an hours worth of work, bloody blue screen of death (think its my graphics card or OC'd RAM). Must've been Autosaving at that exact instant in time because when the computer reset my PCB design file was corrupted and blank!! AND I hadn't backed up my work for 3 weeks!! My leg was winding up to kick the cat, when I remembered Altium keeps a history folder of saved work  In the end, only lost a bit of work, and the cat lives another day. Success.

FWIW Here's a picture of it before I tore the gate driver modules apart.


----------



## JRoque (Mar 9, 2010)

Ah yeah, Altium backup folder has saved my bacon more than once too. But I also developed a nervous tick of hitting the save button after any change. And, I keep 10 versions just in case, mirrored to a file server 

Good progress!

JR


----------



## PStechPaul (May 1, 2012)

Nice! Does Altium have 3-D part models and create the 3-D view as you show? PADS does not have that feature, at least not in PADS2004sp2. But I played around with using TurboCAD scripting and I came up with something like this:










Are you still interested in sharing some design ndetails and perhaps selling one or more of your boards? I might be interested. Please PM or email paul at pstech-inc dot com.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Nice! Does Altium have 3-D part models and create the 3-D view as you show?


Yeh, you can create 3D parts for each component, its good for clearance checks. Mostly i just add basic 3D shapes, but the demo board and IGBTs+heatsinks I drew in Solidworks. If you really want to spend time on it, you can draw everything in solidworks, then when your done export the model into photoworks or similar and render it to make it look schmick 




PStechPaul said:


> Are you still interested in sharing some design ndetails


Yeh I was going to upload the design to the forum when its done, I can email you it currently if you like but the schematics are a mess from adding/deleting on nearly every page haha. I'll have a look if its legible on PDF



PStechPaul said:


> and perhaps selling one or more of your boards? I might be interested.


Yeh I still thinking of buying 10 PCBs, so if your interested in one I can def send it your way. Saves them from becoming table place mats 
Note that all communication with the outside world will use CAN, so you need another CAN capable board+MCU to control it.
There is a pot input for the hell of it, but it is not isolated and the design is live to bus DC- so I wouldn't recommend using it, this is more for testing purposes.
There is an isolated port for the touchscreen LCD which you could use for some control, and isolated USB for programming/debug. The RS232 is NOT isolated.

Basically it has minimal features:
2x current sensor inputs, DC bus voltage input, isolated rotary encoder ABZ input + isolated 5V out, isolated CAN bus + isolated power, non-isolated RS232, isolated USB + isolated power (for programming without external LV power), isolated UART (no iso power).

Have provided breakout for the 20 unused pins, and a 6pin power header with all the voltages used (+15V,5V,3V6,GND,-15V,GND) so you can add more features if required on separate boards. Obviously for safety all peripherals need to be made isolated given the board is grounded to the HV battery pack.

Also with the newly added 14A drivers you should be able to drive pretty much any size IGBTs, so that's a bonus. Gate driver power supplies are 3W.


Might do some more work on it today. Need to stop changing/adding stuff though and just get it finished


----------



## PStechPaul (May 1, 2012)

Mostly I'd be interested in the power section. I might use the IGBTs and drivers and the current/voltage sensors. I'd probably use the USB port and some of the power supplies and drivers. But I'd probably connect an external PIC for the actual motor control implementation. I don't use CANBUS but it might be good to start doing so. If you can supply any sort of schematic I can do a quick sanity check for any potential design problems and also maybe some suggestions on how to make it more "generic" for alternative uses.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Mostly I'd be interested in the power section. I might use the IGBTs and drivers and the current/voltage sensors. I'd probably use the USB port and some of the power supplies and drivers. But I'd probably connect an external PIC for the actual motor control implementation. I don't use CANBUS but it might be good to start doing so. If you can supply any sort of schematic I can do a quick sanity check for any potential design problems and also maybe some suggestions on how to make it more "generic" for alternative uses.


Not really sure what part of the board you want to use. AND you want to swap out the DSP for a PIC . Doesn't seem like this PCB is for you.


----------



## PStechPaul (May 1, 2012)

Stiive said:


> Not really sure what part of the board you want to use. AND you want to swap out the DSP for a PIC . Doesn't seem like this PCB is for you.


Maybe not. I really don't want to migrate to another brand of processors, but if you are using a Microchip device I'd consider getting the development tools as needed. I'd like to use something like the PIC18F2341 which I'm familiar with but the dsPIC33FJ64MC706A or similar is much more powerful. Power is good! 

So I just need enough information to see if it's really worthwhile to use your PCB or not.


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Maybe not. I really don't want to migrate to another brand of processors, but if you are using a Microchip device I'd consider getting the development tools as needed. I'd like to use something like the PIC18F2341 which I'm familiar with but the dsPIC33FJ64MC706A or similar is much more powerful. Power is good!
> 
> So I just need enough information to see if it's really worthwhile to use your PCB or not.


TBH, I'd rather have someone use the PCB "as is". A LOT of work has gone into proper layout, segregation of analog and digital sections, impedance matching/reasonance, high speed digital transmission, stitching etc.

I'd actually rather laminate the spares and use them as ornamental place mats than have them butchered with jump wires and breadboard accessories! Haha. Sorry dude 


Sounds like you just want the power stage anyway, this doesn't need to be precision, a vero-board with milled copper on top to take the current would prob be your best bet.


----------



## JRoque (Mar 9, 2010)

Hi.



Stiive said:


> I'd actually rather laminate the spares and use them as ornamental place mats than have them butchered with jump wires and breadboard accessories! Haha. Sorry dude


Ha! You'd have a heart attack if you saw how I took my 3 core parallel processing, stepper driver, frequency counter, VGA, AGC detector, nuclear-sub ready board spare and made it into a gate opener. That's right, two of the stepper driver chips are driving the wings of my driveway entrance gate. Chef Boyardee has nothing on the spaghetti of wires in that box.

Will you be posting your design schematics as well?

JR


----------



## PStechPaul (May 1, 2012)

Yeah, I was just trying to offer some help offsetting the cost of the boards. I usually get extra boards made, since they are sometimes practically free, and sometimes I use portions of them to test out things. But lately I have found that my needs change enough that it's not usually worthwhile to do the work of mounting components and doing cuts and jumpers and "daughter boards", when I can get exactly the board I need for maybe $100 or so. 

Still, I'd like to see the schematic and part details to get an idea if there is anything useful. I don't know why there would be any objection to hacking a PCB for alternate purposes, especially if it is a first run which may very well need some modifications before it's completely ready for mass production. 

It may not even be worth it to mail the board here from OZ. So I guess I'll just plan to put together a prototype test board which will incorporate one or more of my own ideas on a DTC motor controller.


----------



## Stiive (Nov 22, 2008)

PStechPaul; said:


> and also maybe some suggestions on how to make it more "generic" for alternative uses.





PStechPaul said:


> I don't know why there would be any objection to hacking a PCB for alternate purposes, especially if it is a first run which may very well need some modifications before it's completely ready for mass production.


I think you've misunderstood the project. I'm building this for controller for my own purposes, I have no intention of "mass producing" it. I think that's pretty evident by the fact there's a DEMO board sitting on top... This is just a stepping stone prototype where everything is expendable and easy to replace.

If there are no major errors in the board design/schematic, I will only have ~8 spare. I'd rather give them to people who are going to use them the way they were designed to be used, and I'm sure there are more than 8 people who would. A cheap 3-phase motor controller, why not? But i'm not interested in modifying it to suit other peoples needs, or to make it more "generic". Again, this board is designed for MY purposes of DTC, but is also compatible with FOC. I'd maybe populate a few boards for people if they dont have the means, but im not gonna run a business of it, besides i don't have the time.

Your probably right about the Aus thing too, probably better still to give them to people close by so i can help with populating the boards and have programming buddies  Though I feel most people would just download the STM FOC code and be done with it rather than try develop their own motor control. There's over 150 people in my local EV group though so many I need to hand select 

Anyway, the important thing for me is to finish the board. It's so easy to get distracted 

And yes JRoque, i'll happily post the schematic once its done. As previously mentioned, its barely legible at the moment with the amount of recent last-minute changes


----------



## stickytechnology (Sep 19, 2010)

Cool! I'm curious about your encoder input, though. Is that just to make the board compatible with FOC, or are you using a special flavor of DTC that requires an encoder. That was one of the things that attracted me to DTC in the first place, is that an encoder isn't needed, at least for the basic algorithm.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Cool! I'm curious about your encoder input, though. Is that just to make the board compatible with FOC, or are you using a special flavor of DTC that requires an encoder. That was one of the things that attracted me to DTC in the first place, is that an encoder isn't needed, at least for the basic algorithm.


SVM requires a very lax speed estimation, but its more there for if i cant get sensorless speed estimation working well enough for a speed control loop (would be good for testing).
Have also tried to design the board so it is directly compatible with the Tumanako open-source FOC code, which at the moment requires encoder feedback.


----------



## Stiive (Nov 22, 2008)

BAM! Boards arrived this morning... not long now!


----------



## Stiive (Nov 22, 2008)

Stiive said:


> BAM! Boards arrived this morning... not long now!


Picked up my Semikron equipment today  Exciting stuff, although they are for the Version2 beast.









Picture shows SkiM909 + 3x Skyper32 Pro + 900V 1000uF Cap bank + water cooled heatsink + my PCBs.

Will be populating the boards on Monday. AND I already have the basic code compiling... 
It's dawned on me that I could have this working soon if i can stay motivated... scary really...


----------



## JRoque (Mar 9, 2010)

Hi. I'm not sure if that board was designed to drive a car or make you a tuna sandwich... but regardless, what a beautiful piece of work! And I see you didn't spare on the niceties by adding blue masks and whatnot. How much copper did you pour on, 2oz, 4oz? How many layers?

I'm sure you'll have lots of fun populating the board. Let us know how you do with the small smt parts. Best wishes on making it all work together.

JR


----------



## Stiive (Nov 22, 2008)

JRoque said:


> Hi. I'm not sure if that board was designed to drive a car or make you a tuna sandwich... but regardless, what a beautiful piece of work! And I see you didn't spare on the niceties by adding blue masks and whatnot. How much copper did you pour on, 2oz, 4oz? How many layers?


Haha thanks, gotta be blue, its my favourite colour  
Its about 0.03mm thick copper, i've left it exposed so I can clamp some copper bus bars on top.



JRoque said:


> I'm sure you'll have lots of fun populating the board. Let us know how you do with the small smt parts.


Yeh not looking forward to the 0402 parts. I've mostly tried to use 0805 though.
I'll prob set up a camera while populating it, and show before and after it goes in the oven pics.



JRoque said:


> Best wishes on making it all work together.
> JR


Cheers, thanks


----------



## PStechPaul (May 1, 2012)

Looks really good. I see you have at least 5W DC-DC converters for the gate drive supplies. Probably overkill, but no problem as long as they handle the bus voltage safely.

I like your instructions:

Apply power
Wait...
Good luck populating the boards and getting the beast up and running. Hope you can make some video of the progress.


----------



## JRoque (Mar 9, 2010)

Hi. If you don't have one already, an SMD workstation with hot air gun will save you time and hair falling off your head. I picked up one of these: http://www.ebay.com/itm/POWER-8000-...964?pt=LH_DefaultDomain_2&hash=item2a21b7b4ec and it has worked out great. For 0402 parts, something that might help is using the tip of a small flat screwdriver perpendicular to the part to hold it down while you solder/hot air it.

JR


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Looks really good. I see you have at least 5W DC-DC converters for the gate drive supplies. Probably overkill, but no problem as long as they handle the bus voltage safely.


They are 3W with 14A gate drivers, just incase i want to test with some Fuji brick IGBTs i have. Need a bit of power to switch at the speeds i'm hoping.



PStechPaul said:


> I like your instructions:
> 
> Apply power
> Wait...




Haha you've got a keen eye. That's been there since the start of the layout, obviously as a joke... Then it sort of became part of the 'furniture', so i dared not remove it.





PStechPaul said:


> Good luck populating the boards and getting the beast up and running. Hope you can make some video of the progress.


Will do, thanks.


----------



## Stiive (Nov 22, 2008)

JRoque said:


> Hi. If you don't have one already, an SMD workstation with hot air gun will save you time and hair falling off your head. I picked up one of these: http://www.ebay.com/itm/POWER-8000-...964?pt=LH_DefaultDomain_2&hash=item2a21b7b4ec and it has worked out great. For 0402 parts, something that might help is using the tip of a small flat screwdriver perpendicular to the part to hold it down while you solder/hot air it.
> 
> JR


Thanks JR, im taking it to a hobby electronics shop nearby (www.squarebit.com.au). The guy there has vinyl cutters for cutting the solder paste masks, and a reflow oven - so he's gonna help me out.
Normally they charge some nominal amount for this service, but i've bought a fair bit from the guy so he's doin me a favour


----------



## stickytechnology (Sep 19, 2010)

Nice! Good luck!


----------



## stickytechnology (Sep 19, 2010)

Hey Stiive, what current transducers are you using? I'm faced with redesigning my current sense system due to the woes upthread, and I figure I might as well try what is working for you


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hey Stiive, what current transducers are you using? I'm faced with redesigning my current sense system due to the woes upthread, and I figure I might as well try what is working for you


Well, i'll let you know soon how well they are working for me, at the moment still trying to set up the triple simultaneous mode on the STM ADC. I ended up with the LEM HASS 200-S on this version
http://www.digikey.com.au/product-detail/en/HASS 200-S/398-1064-ND/1680530
It's good cus you can override the voltage ref with a 5mA sink/source ref chip. I've set mine at 1.6V to coincide with ~half my ADC range. 


Next version might go closed loop for that lil bit extra accuracy and try the LEM LA306-s or similar. Its double the price though and you have to deal with negative ADC values.


----------



## stickytechnology (Sep 19, 2010)

Thanks for the tip- that looks like a nice part. I wish I could help you on the triple simultaneous problem, but the STM32 I picked didn't offer that, so I am doing two phases simultaneously, and then the third as a quality check. It looks like I have a board spin in my future, so I think I'll switch to the MCU you are using.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Thanks for the tip- that looks like a nice part. I wish I could help you on the triple simultaneous problem, but the STM32 I picked didn't offer that, so I am doing two phases simultaneously, and then the third as a quality check. It looks like I have a board spin in my future, so I think I'll switch to the MCU you are using.


I think the triple is identical to the dual mode, except for an extra channel. Im getting proper readings in independent modes which is strange, ahwel im obviously doing something wrong, gotta keep reading the reference manual.

The readouts of the current sensors are a bit useless at the moment because i wont populate my power section until i make my copper bus bars. Maybe tomorrow. But even then, I need a power source to test with, maybe a 12V battery will be able to turn my 415V 1kW motor slowly... hmm.. doubt it. Atleast i can put some current through my sensors to test the readings

Everything seems to be working so far, which is a massive relief! Well everything except my USB isolation module. I've checked and rechecked the schematic, i think i mustve fried the IC in the oven  Ahwel, dont really need it, would have made it easier to test spinning my motor from a wall transformer though.


----------



## stickytechnology (Sep 19, 2010)

Hmm, for the dual mode the one I have stuffs the result of one conversion in the low 16 bits of the DMA'd word, and the other one in the high 16 bits. Do you have to use two DMA channels when you use 3 ADCs simultaneously?


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hmm, for the dual mode the one I have stuffs the result of one conversion in the low 16 bits of the DMA'd word, and the other one in the high 16 bits. Do you have to use two DMA channels when you use 3 ADCs simultaneously?


Finally got it working  it was always working, just was left justified so i was getting garbage out. Apparently its some glitch with STM in triple mode.

Umm, it stores the 6 values in DMA in a circular buffer (size 6) of half words.


----------



## mizlplix (May 1, 2011)

<What he said>




Miz


----------



## stickytechnology (Sep 19, 2010)

I got to thinking about the bandwidth of your current transducers, and it has got me a little worried. My thinking goes like this:

300V across your 50uH motor gives a 6A/us current slew rate.
If we assume the 50kHz bandwidth of your transducer is equivalent to a low-pass filter with a pole at 50kHz, it introduces a time delay of about 10us, giving a current error of up to 60A.

This is obviously a sketchy approximation, with a lot of simplifying assumptions, but it might need more study.

In practice, I think the result would be that you are always overestimating torque, because the current vector is always reported as being behind where it really is. This might not be such a big deal, because you could implement some kind of lookahead estimator.

Interested to hear your thoughts, and whether you have put this into your simulations.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> If we assume the 50kHz bandwidth of your transducer is equivalent to a low-pass filter with a pole at 50kHz, it introduces a time delay of about 10us, giving a current error of up to 60A.


Yeh never really looked at that value. It says in note4 it's for small signals only and used to avoid excessive heating of the core. I've been told in order to prevent heating of the core, you need to size the HASS to keep "RMS current*freq" for each frequency harmonic component to less than 400,000. I'd say the LPF is to limit harmonics above 50kHz which even though may have small amplitude, attribute to the heating significantly. (e.g. 1Mhz * 0.2A = 200,000 - half the allowed value)

The datasheet states it reacts to 90% of I_PN (180A in my case) in under 5uS. It also says it traces 100A/uS accurately so i assume there is no problem. Also, this 200A sensor is just going on my small inverter, and maybe also used in initial testing on the larger one. 

The LA306-s has much faster response time <1uS to 90% of I_PN and better accuracy. I may even get the next size up to get nominal current about 600A. It also has the 50kHz bandwidth.


----------



## stickytechnology (Sep 19, 2010)

Gotcha- looks like I should have read the rest of the data sheet  That's an impressive part


----------



## PStechPaul (May 1, 2012)

I haven't seen schematics for your design, so I'm not sure why you need to monitor the high side with an isolated Hall effect device, rather than the low side where sense resistors and differential amplifiers would work without needing isolation. But if bandwidth is a problem, perhaps you may consider a high side monitor such as: 
http://www.supertex.com/pdf/datasheets/HV7802.pdf

It can be used on a 450 VDC bus and has rise/fall times of 700nSec to 2 uSec. 

I can understand using the transducers if you need to measure the current in each phase of the motor directly, but since AFAIK you will only ever have one of the low side IGBTs on at any time, the current measured in its emitter should be identical to the current measured on the motor leg connected to its collector. 

The transducers on the high side motor connections might be better used for RMS current measurement rather than time critical current readings where you are monitoring the current rise in the motor inductance and (presumably) switching it off at a preset value or where the rate of rise indicates the start of saturation. As noted, 6A/uSec requires a very fast and accurate snapshot of the current during the PWM applied condition in order to achieve optimum performance.


----------



## Stiive (Nov 22, 2008)

Paul, 
Yeh the CTs are used to measure current in the motor phases. Measuring current through a shunt resistor just doesn't make sense at higher power levels


----------



## Stiive (Nov 22, 2008)

Well all the required hardware seems to work.
I'm scared to finish the code off cus that means i'll have to test it


----------



## fireblade (Aug 20, 2012)

Great technical posts.

I've never heard of this control method until this post. Thanks.

From reading all the various vendors, IRF, ATMEL, FREESCALE and MICROCHIP, the consensus is that sensor-less motors are difficult to control at low or varying speeds. This is due to imperceptible measurements of back-emf of the non driven phase within the motor at low speeds. And timing can become inaccurate at varying speed and thus introduce slip angle.

Does this new control method not require back-emf to determine its position within the rotation cycle?


----------



## stickytechnology (Sep 19, 2010)

No, it doesn't need back-emf readings. It needs two phase currents and the DC bus voltage at minimum; the third phase current can be used for error-checking, and Stiive says that high performance drives are better off measuring the phase voltages directly instead of using the DC voltage and the switch states to infer phase voltages.

There are problems at low speeds, one of which is that since the flux is estimated by integrating the phase voltages, any offset in the sensors will show up as drift. Using the DC bus voltage times the switch state matrix takes care of this, as the DC voltage measurement offset cancels.

This technique has been around since the mid-80's but has not been extensively commercialized, maybe due to ABB holding a patent on it.

The wikipedia entry is actually pretty good:

http://en.wikipedia.org/wiki/Direct_torque_control


----------



## stickytechnology (Sep 19, 2010)

Also, there is no non-driven phase in DTC. Phases are always either connected to V+ or V-, except during dead time.


----------



## PStechPaul (May 1, 2012)

stickytechnology said:


> Also, there is no non-driven phase in DTC. Phases are always either connected to V+ or V-, except during dead time.


I realize this must be true, but it seems counterintuitive to me. If phase A is connected to V+ and both phase B and phase C are connected to V-, then it seems like B-C is shorted and the same voltage is simultaneously applied to A-B and A-C. And in that case, there would be no way to measure BEMF because the voltage to V- reference would always be either V+ or 0. 

I tried to find details on the measurement of BEMF for sensorless control, and so far not much luck. So it may be that the reading is taken during the dead time, although it is usually well under 1 uSec and could be a short as 1 or 2 clock cycles which would be 100-200 nSec. Otherwise maybe the current could be measured and the ripple may be proportional to rotor speed.


----------



## fireblade (Aug 20, 2012)

Sensorless back emf information. Maybe this will help.

http://ww1.microchip.com/downloads/en/AppNotes/01162A.pdf

http://www.microchip.com/pagehandler/en-us/technology/motorcontrol/resources/home.html


----------



## stickytechnology (Sep 19, 2010)

I'm not terribly up on other forms of vector control, but I don't think FOC uses back-emf measurements either. I think it is a technique used mostly in permanent magnet motors.

You're right PStechPaul, the applied voltage in your example A-B and A-C is equal, and the applied voltage B-C is zero. That means the current A-B and A-C is increasing, and B-C is not changing (neglecting switch and resistive losses). The next switch state (if we are running in the field weakening region, where the flux vector describes a hexagon) would be disconnecting either B or C (depending on the direction, let's choose C) from the V- rail and connecting it to the V+ rail. Now the voltage A-B is still positive, so current is still increasing there, but now B-C is negative, so the current starts to decrease. Voltage A-C was positive, but now it is zero, so current in that phase stops increasing and holds steady.

Obviously the picture becomes more complicated where we are running at lower speeds and the flux vector describes a circle (sinusoidal operation) because we will have multiple switch transitions per sector.


----------



## PStechPaul (May 1, 2012)

After a bit more digging I found some information that shows that the back EMF is actually calculated from the motor's inductance, resistance, stator voltage vector, and rate of change of stator current vector:
http://www.ornl.gov/~webworks/cpr/pres/106041.pdf

I have read AN1162 and after some thought I think I see the principle involved. It seems that the BEMF is a sine wave with a particular phase angle with respect to the stator driven EMF and its current. The phase angle is probably related to slip so that it will be greatest at maximum torque and minimum at zero torque, at which point the BEMF equals the applied EMF. I would expect that there would no longer be a constant phase shift under conditions of loss of synchronization for a locked rotor or beyond breakdown torque. Or possibly there is a maximum phase shift which occurs under such conditions and at that point the speed sensing would no longer be valid. So the rotor speed would be approximated by the phase angle and slip if they are within the motor parameters.

I tend to comprehend things on a visual basis rather than mathematical, so I would like to see waveforms of the measured quantities. Obviously, the measurement of phase voltage does not provide much useful information about the condition of the motor, since it will always be very close to V+ or zero. Any deviation would be due to the ESR or droop of the DC bus, and that is not a reliable quantity. 

However, it does mean that it should be measured at the same time as the phase current is measured, so the deviations can be taken into account. Ideally, the bus capacitors should hold the voltage constant during each PWM cycle, and the total current draw for a three phase motor tends to be constant at a given torque and speed, so the voltage should not change significantly under static conditions. But in an EV, these parameters will change often and sometimes rapidly, and the battery condition will also play a large part.


----------



## stickytechnology (Sep 19, 2010)

Hey, that's a really interesting paper, and a really smart inverter design. They are using a soft switching inverter, which means that they have a DC bus that oscillates between 0 and 400V, and then the three phase bridge that switches only when the DC bus is near 0V. This way they can measure the back-emf because it will be significant- the bus voltage will jump to whatever the phase emf is when the bridge switches close, but before the bus convertor switch closes (for this to be true, the motor impedance has to be low compared to the DC link impedance when the link switch is open) It's a little bit like the series buck converter that I suggested upthread, but even better, because you're doing near-zero voltage switching. Not sure if this is compatible with DTC, as the DC bus voltage is so dynamic, though.

Note the 2 phase current sensors, and one battery current sensor. Neat design!


----------



## PStechPaul (May 1, 2012)

I had to find more information on the soft-switching inverter concept. Here is a recent document with more details and some amazing results, such as a 27 kW inverter with better than 99% efficiency and a cost of less than $500.

http://www1.eere.energy.gov/vehicle..._2010/power_electronics/ape011_lai_2010_o.pdf

And this for SRMs:

http://scholar.lib.vt.edu/theses/available/etd-071499-192601/unrestricted/NAVETD1.PDF

And related documents:

http://www.ee.bgu.ac.il/~pedesign/G...iency Evaluation of A 55kW Soft-Switching.pdf
http://www.ijest.info/docs/IJEST10-02-12-108.pdf
http://www.yildiz.edu.tr/~bodur/Yayinlar/uam5.pdf


----------



## stickytechnology (Sep 19, 2010)

I dunno, that seems like a lot of complexity. There are 18 switches, 12 diodes, 6 inductors, and 3 caps, not counting the DC bus capacitance. I get that paralleling IGBTs and MOSFETs might be a good idea to gain efficiency, but the rest of it seemed more elegantly dealt with by the resonant DC bus idea from before.

Also, the $500 price is just for the modules. A similar power inverter made with dual IGBT modules only has about $250 in the modules themselves. The rest of the cost comes from the copper bus bars, the caps, the current transducers, the cold plate, and the gate drive electronics (of which you'd need 3 times as many with this design). It was neat to see the construction method of that module, though. I have a couple dead ones lying around that I was thinking of sawing open 

At any rate, we're tacking far from the original topic of DTC. Should we start another thread on advanced inverters?


----------



## Stiive (Nov 22, 2008)

Getting there...
Hopefully will make the bus bars tomorrow so I can test it on my small motor... need some leadacid's... anyone in Melbourne?


----------



## stickytechnology (Sep 19, 2010)

Nice! What's the lead for? I use an old 40V HP bench supply to test the power section and it turns my small motor OK, but I'm over here in 240V land. It might not turn a 480V motor too well.

Do you have a DC bus precharger too?

I gotta say, that's a nice piece of work. I'm tempted to try to buy a board off you, but it would sit on my shelf until at least next March with all I've got going on here.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Nice! What's the lead for?


Top left is USB isolation circuit so I can program/debug on the fly. 
The other cables belong to the Saleae logic analyzer so i can see whats happening with the gate signals (no CRO with me atm), and listen to the UART comms.



stickytechnology said:


> I use an old 40V HP bench supply to test the power section and it turns my small motor OK,


Yeh, i might be able to use some sort of bench supply, all of my isolation is 3kV+ so shouldn't be an issue. Need something with decent voltage though



stickytechnology said:


> I'm over here in 240V land. It might not turn a 480V motor too well.


Where abouts are you? We're also 240V in Aus... I think its just the yanks and maybe China on 110V. My motor is 415V (240V*sqrt(3)).



stickytechnology said:


> Do you have a DC bus precharger too?


 Nah, that'll be external. Trying to keep as much heat as possible away from the PCB



stickytechnology said:


> I gotta say, that's a nice piece of work. I'm tempted to try to buy a board off you, but it would sit on my shelf until at least next March with all I've got going on here.


Cheers. The boards were only ~$16, but let's see how it works first  All the hardware works individually, but will be interesting how well it works together complete with EMI. Guess that wont be an issue with external IGBT bricks though. No rush anyway, i've got no plans for them. I've put two in a picture frame (one facing front one back) on my wall, haha...

As you can see, the power stage isn't populated yet, need to make the bus bars first.


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Where abouts are you? We're also 240V in Aus... I think its just the yanks and maybe China on 110V. My motor is 415V (240V*sqrt(3)).


Yeah, I'm in the US. We have that crazy split phase system, where household voltage is 120 or 240, but low voltage 3 phase is either 208, 240, or 480, so even small motors like my test motor (250W) are usually 480/240 Wye, which is what I meant. I have a small motor that's wired 208 Wye/120 Delta, which would be an awesome configuration for EV with a 360V pack, but I've never seen a big one.


----------



## Stiive (Nov 22, 2008)

Well there you go... learn something new everyday. 
Glad to hear at least some of the single phase is 240V over there. 

I'd imagine charging an EV on 120V would take some time..


----------



## subcooledheatpump (Mar 5, 2012)

Really what it is, Just a center tapped transformer

120 one side, 120 the other side, and the center tap, 0 in the middle. 

Just using the two sides without the center tap gives 240V 60Hz. I always use that to charge my van

Anyway, your circuit board(s) are looking good. Can't wait to see it running


----------



## Stiive (Nov 22, 2008)

subcooledheatpump said:


> Really what it is, Just a center tapped transformer


So you have access to this transformer? i.e. each household has one?


----------



## subcooledheatpump (Mar 5, 2012)

In a manner of speaking, yes. 

Each house has three wires coming into a distribution box/panel from the transformer

The distrubution box allows the user to connect a single pole breaker, which connects to only one side of the transformer, or a double pole breaker which connects to both sides of the transformer.

If using just a single pole breaker, then the neutral, or 0 volts serves as the common and earth ground is the ground. 
If using the double pole breaker, both sides are used and the neutral can be used as a ground, along with the earth ground. (a little wacky, I know)

So basically using a single pole breaker gives 120 volts, and using a double pole breaker gives 240 volts. Mostly, only larger appliances (stoves, dryers, air conditioners) only use the double pole breakers for 240 volts.

What gets me about it, there is a huge potential for unbalance between the two sides of the transformer. I try to use as many things as I can on 240 but I can't help what the neighbors on the same transformer do....


----------



## Stiive (Nov 22, 2008)

fair enough... I'm glad lessons were learned over there so I can benefit from 240V as standard in my home 

Anyway, diverging from topic a bit, and i'm about to spent this glorious spring day making bus bars


----------



## Stiive (Nov 22, 2008)

Well, haven't been doing much work on the controller... spent another hour on the code the other night (now 1.5hours total ), but at least i made the busbars last week.

Now i'm thinking ahead to a power source to test this bad boy. Prob will need atleast ~60V i'd say to turn the 415V motor... What can I use?

I have an old UPS (24v batt), old microwave, laptop chargers, audio analogue and digital amplifiers... umm... CRT TV... what can i (safely) conjure up? Don't really want to start with HV such as rectified mains... Maybe i have to buy some old lead acids


----------



## subcooledheatpump (Mar 5, 2012)

what about using a variac and an isolation transformer? 

You can vary the voltage with the variac and be isolated from the mains with the isolation transformer


----------



## Stiive (Nov 22, 2008)

subcooledheatpump said:


> what about using a variac and an isolation transformer?
> 
> You can vary the voltage with the variac and be isolated from the mains with the isolation transformer


The variacs I have access to are all three-phase. I only have single phase at my house.

Hmm though one of the variacs we hacked apart could easily be rigged up to a single phase lead, but i think the rectifier circuit is in the bin now anyway. We were using it as an EV charger.

Other ideas? I only really have access to the equipment listed before, and i don't really want to make my own DC-DC - though i would easily have all the components necessary. 
If its too much trouble, I have access to test elsewhere - but would rather tinker till the wee hours in my own space.


----------



## Stiive (Nov 22, 2008)

Hmm, this could be an option... mod a PC power supply to adjustable voltage, and put in series with my 24V of UPS batteries. Should have one somewhere.

26+24V=50V. Might be enough and should be good for an amp. Maybe i have another 12V battery somewhere as well to throw in the mix.

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



Ahwel, i'll finish my code first and have a think about it.


----------



## JRoque (Mar 9, 2010)

Hi. Are you sure you want to risk your nice power stage with a rigged up power source that can UV or noise up your measurements? I would go for the suggested variac/isolation transformer. You could reuse that when designing your charger in the future.

JR


----------



## Stiive (Nov 22, 2008)

JRoque said:


> Hi. Are you sure you want to risk your nice power stage with a rigged up power source that can UV or noise up your measurements?


It'd be a good test, the controller should be robust enough. The hacked PSU should still be somewhat regulated aswel. It cant do any damage though at 50V, it'd need a lot of ripple to upset the 650V IGBTs.



JRoque said:


> I would go for the suggested variac/isolation transformer. You could reuse that when designing your charger in the future.
> JR


Who said I was going to design another charger? No thanks... haha.

If I'm going to use the variac, I might as well use the spare 300V LiPo pack in the same room. That's my plan for in a few weeks, but first i want to get the motor spinning in the comfort of my own home on a test rig.

Still coding though, I'm still a few hours off the code being complete, which judging by my recent poor productivity and procrastination habits, will take a few weeks


----------



## Stiive (Nov 22, 2008)

Well, the code is basically written now... Code takes 25uS for a complete cycle... hmm, wanted 5uS lol.
Gotta optimize it i guess, but 25uS and heck prob even 1ms will be fine for testing my small motor. Once the code is perfected ill try optimize it a bit, but maybe 5uS was a bit ambitious.

A weird thing happens when i turn on the IAR auto optimizers, the code goes haywire and skips lines and interrupts don't always fire  hmm ill have to look into that later too


----------



## stickytechnology (Sep 19, 2010)

Stiive said:


> Well, the code is basically written now... Code takes 25uS for a complete cycle... hmm, wanted 5uS lol.
> Gotta optimize it i guess, but 25uS and heck prob even 1ms will be fine for testing my small motor. Once the code is perfected ill try optimize it a bit, but maybe 5uS was a bit ambitious.


Nice work! I played all kinds of math tricks to speed up my loop. For instance, sqrt(3)/2 is almost 7/8, so you can multiply by 7 and do a bit shift to divide by 8. I did all my variables as integer types, so bit shifting works for division.




Stiive said:


> A weird thing happens when i turn on the IAR auto optimizers, the code goes haywire and skips lines and interrupts don't always fire  hmm ill have to look into that later too


Ahh optimizers...
"volatile" is your friend 

Good luck!


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Nice work! I played all kinds of math tricks to speed up my loop. For instance, sqrt(3)/2 is almost 7/8, so you can multiply by 7 and do a bit shift to divide by 8. I did all my variables as integer types, so bit shifting works for division.


Ah okay.. im using the FPU on the chip, so i'm using all floats.
sqrt(3)/2 becomes sqrtf(3)/(float)2

Massive massive speed improvement with the FPU on!!!

EDIT: Improvement in speed if you need float/double answer.


----------



## stickytechnology (Sep 19, 2010)

Wow, FPU too. That chip is a wonder. I see it has DSP instructions too. Do you use those?


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Wow, FPU too. That chip is a wonder.


Yeh, i'm pretty happy with it!! Might go dual processor on my next version though  Or upgrade to a 300mhz+ processor or hybrid with FPGA. We'll see.




stickytechnology said:


> I see it has DSP instructions too. Do you use those?


Umm not sure... haven't implemented any dsp specific commands... but I reckon the compiler may be utilizing some of the capabilities, esp with the DMA arrangement


----------



## Siwastaja (Aug 1, 2012)

This would be interesting to implement on FPGA. All problems with timing gone! Nanoseconds instead of microseconds! Everything happening concurrently if needed! No need to rely any existing HW, just roll your own.

We are running a simple V/f now on FPGA. Of course you could do things this simple on many 8-bit MCUs with built-in 3-phase inverter capable PWM HW.

But in the future, I hope to implement FOC and/or DTC on FPGA. Maybe you could show your code when the time comes, as a reference? 

Just for reference, you can see our VHDL at http://www.students.tut.fi/~alhonena/inverter.vhd 

That said, of course there is more to do when doing your own HW, too. It pretty much boils down how suitable the existing HW in the DSP/MCU is for the purpose. If it is just what is needed, then it's the easiest solution.

I'm rooting for your project! Keep up the good work!


----------



## jhuebner (Apr 30, 2010)

Stiive said:


> Well, the code is basically written now... Code takes 25uS for a complete cycle... hmm, wanted 5uS lol.
> Gotta optimize it i guess, but 25uS and heck prob even 1ms will be fine for testing my small motor. Once the code is perfected ill try optimize it a bit, but maybe 5uS was a bit ambitious.
> 
> A weird thing happens when i turn on the IAR auto optimizers, the code goes haywire and skips lines and interrupts don't always fire  hmm ill have to look into that later too


In a paper by ABB they say their loop runs at 40 kHz/25µs. Seems your already up there with ABB


----------



## Stiive (Nov 22, 2008)

jhuebner said:


> unless Stiive is a prodigy.


Could it be true?


----------



## Stiive (Nov 22, 2008)

After a week+ of doing absolutely nothing on this controller i'm gonna try finish it today.

I'm only writing this to hold myself accountable and give myself motivation 

Okay, out to my workshop (garage) I go.


----------



## Stiive (Nov 22, 2008)

Okay so before procrastination set in yesterday I managed to assemble the VSI on the board.

Made a few mistakes in my rush though;
- Forgot to tin the top of the copper bars before i put them on, so i cant solder the IGBTs to the copper for extra conductivity
- Forgot to solder the snubber caps on before i placed the copper bars on top, so therefore they are only soldered on the underneath of the PCB.

But ahwel, will still work fine... I also had someone lending me some electrically conductive paste to put on the bus bars, but got tired of waiting so assembled it anyway. Figure if i want higher current output ill connect up some external IGBT bricks anyway.

Optimised the code down to 7.1uS, but gonna keep it at 50uS sampling time for now... Also providing more information readouts to my LCD for easy debugging, and a dead-mans switch


Big question now is... the hardware is complete.... the software is working.... should i try it on my motor?? Haha, problem is the highest voltage i have is a 19V laptop charger, dont think it'd spin the 415V motor anyway, maybe i could put it in series with my car battery. Or find some decent isolated transformer based power supplies and put them all in series.. haha. I think DTC might surprise me on its ability to effectively make use of the 19V though and spin the motor or atleast make it twitch, but we shall see.

Also I don't have a CRO, so cant know for sure if its all working correctly... I see the deadtime is consistent at 1.3333uS, but i think i may also be getting a bit of ringing (could be the mess of wires from the logic 8). Every now and then, the logic signal to the gate drivers give a 41.7ns hiccup (24mhz fastest sample rate of the logic8). Obviously im reading it as a digital signal, whereas itd be more of an AC ripple.

Might put a DC bus of 5V, and read the three phases as logic and see if i get ringing there.. brb


----------



## JRoque (Mar 9, 2010)

Hi. How about using 3 light bulbs and run it off 1/2 rectified mains? You get to see it work but without the currents/inductance nasties.

BTW, what is your code doing in 7us? I ask because most "best practices" say you should LD a register or set a pointer and get out of the IRQ. I never do that  and I suspect you're not doing that either. If I need tighter timing, I rely on PWMs, clocks, or other internal or external hardware and just set the values from my code.

JR


----------



## stickytechnology (Sep 19, 2010)

It's hard to say what the DTC algorithm would do with a pure resistive load. Probably go to the six-step limit case, but it probably wouldn't tell you anything useful.

I think 19V should be just fine to turn a small motor, even a 415V one. Even better, use a current limited bench supply in case there is shoot through. If you need more voltage, most "wall warts" (cell phone chargers, etc) are isolated, so you could stack a few and get the voltage you need.


----------



## Stiive (Nov 22, 2008)

JRoque said:


> Hi. How about using 3 light bulbs and run it off 1/2 rectified mains? You get to see it work but without the currents/inductance nasties.


Yeh, want to try low voltage first. Also dont have a standalone rectifier, would have to hack into something. Also im imagining DTC would do some strange things trying to flux a set of lightbulbs  Would probably not give a 3-phase waveform. Will eventually try though, thats how we tested our old FOC controller.



JRoque said:


> BTW, what is your code doing in 7us? I ask because most "best practices" say you should LD a register or set a pointer and get out of the IRQ. I never do that  and I suspect you're not doing that either. If I need tighter timing, I rely on PWMs, clocks, or other internal or external hardware and just set the values from my code.
> JR


The 7.1us is the time between the DTC sample interrupt is first triggered, and once the new switch states are ready. i.e. the time it takes to do the ADC conversions, DTC calculations and lookup a new switch state. 

The switch states are calculated and issued in the ADC IRQ, but then the code enters a wait state counting clock cycles before issuing the new switch states for precision timing. The deadtime is also computed in a similar way.
Currently i have another timer at 24uS which then enters the precision loop of counting the clock cycles since it triggered the sample to give exactly 25uS before the new states are issued. This allows me to use the 24-7=17uS to send data to my LCD and read the new throttle pot input etc. I also have 24uS after the new switch states to do stuff before the next interrupt is triggered.


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> It's hard to say what the DTC algorithm would do with a pure resistive load. Probably go to the six-step limit case, but it probably wouldn't tell you anything useful.
> 
> I think 19V should be just fine to turn a small motor, even a 415V one. Even better, use a current limited bench supply in case there is shoot through. If you need more voltage, most "wall warts" (cell phone chargers, etc) are isolated, so you could stack a few and get the voltage you need.


My thoughts exactly.


----------



## Stiive (Nov 22, 2008)

TURNED ON THE CONTROLLER AND CONNECTED A 19V LAPTOP CHARGER TO THE DC BUS..... CONNECTED THE MOTOR..... 

ANNNDDDDDNDNDDNDNDNDNDNDDDD.... motor is oscillating 1/4turn..... 

NO EXPLOSION SO FAR!!! 


check back soon. This might work yet!


----------



## Stiive (Nov 22, 2008)

Well.... I'm gonna give up for tonight... haha got it doin 180deg turns, but thats as far as it goes... maybe theres not enough voltage, but seems to have a decent amount of torque if i stall it...

I def thinking there's something wrong with my estimators atm. The torque estimation seems to be okay, but the flux estimator gets massive drift... as in, within a couple of seconds its sometimes at 10-15Wb  Something wrong there! 
Ive checked the calcs, they seem to be right.. stupid debug mode though wont tell me all the values of the variables which makes it extremely hard to debug. Most of them show <unavailable> when you do mouse over while stepping . Also getting a bit of noise on the ADCs, ~0.1A, which is hard to eliminate considering im reading from a +-600A sensor! Well, i've got about 10turns goin through it so its 60A atm.

I'll work something out tomorrow, had my excitement for the day.


----------



## subcooledheatpump (Mar 5, 2012)

Thats great news. No explosions is good. I'm waiting for the video of it running at full power... keep us posted.


----------



## Stiive (Nov 22, 2008)

need more volts!! MOAR.

How can I tell how good a wall transformers isolation is without a megger?


----------



## subcooledheatpump (Mar 5, 2012)

measure the voltage between the line and the output. should be 0 volts (or close to 0)


----------



## PStechPaul (May 1, 2012)

Stiive said:


> need more volts!! MOAR.
> 
> How can I tell how good a wall transformers isolation is without a megger?


A neon lamp voltage tester is one way. But an actual Megger or IR tester is better. You can get or make a HV source and then add some resistance and a milliammeter or indicator lamp or an AC relay to trip on some level of overcurrent. It's a handy device to have for testing breakdown voltage of your drive components as well as motors, transformers, etc. Generally breakdown is tested at 1000V + 2x peak operating voltage, so 120 VAC devices should pass 1250 to 1500 VDC, and 480 VAC components should withstand 2000 to 2500 VDC. I think European standards may be as high as 4000V.

http://www.kemet.com/kemet/web/home...76AE007F3F0D/$file/F9000_GenInfo_IntStand.pdf
http://www.interelektro.com/catalogs/asresearch/AR-00_ElectricalSafetyTestingGuide.pdf


----------



## Stiive (Nov 22, 2008)

jhuebner said:


> there won't be one for a long time unless Stiive is a prodigy.



IT WORKS IT WORKS IT WORKS IT WORKSSSS!!!!!

Oh boy does it work and spin real good!!


----------



## Stiive (Nov 22, 2008)

subcooledheatpump said:


> Thats great news. No explosions is good. I'm waiting for the video of it running at full power... keep us posted.


I'll post a video tomorrow. Doesn't spin very fast cus voltage limited running 19V off a laptop charger, but gets some decent torque for 3A. Spins to a few hundred RPM.

I picked up a 4pole motor today which i might have some fun with tomorrow.

Pretty wrapped that's its working now, had some problems with the flux angle. Also didn't like BEMF approximation on such a small motor. 
All fixed now though


----------



## smpavlik (Mar 28, 2011)

Can you pleas share your schematic?


----------



## DawidvC (Feb 14, 2010)

Congratulations!!!


----------



## Stiive (Nov 22, 2008)

smpavlik said:


> Can you pleas share your schematic?


PM me your email address.

I'm planning to set up a website to host the schematics and code. Ill post the link here if/when it eventuates


----------



## Stiive (Nov 22, 2008)

Dankie meneer


----------



## Stiive (Nov 22, 2008)

Just uploaded the boring-est movie to YouTube of me spinning two different motors.

I didnt watch the movie from start to end until after i uploaded it, rookie mistake.


----------



## Stiive (Nov 22, 2008)

Link to the aforementioned boring video 

http://www.youtube.com/watch?v=flm-LZzXT70&feature=youtu.be


----------



## PStechPaul (May 1, 2012)

Heh! Not bad. It's good to see some visible progress! With DTC, I assume that the pot setting will correspond to a certain amount of acceleration so the speed will increase until there is either enough drag to satisfy the torque setting, or the voltage (or current) limit of the power supply is reached?


----------



## jhuebner (Apr 30, 2010)

This is good progress! Congratulations on getting something that complex to work.
I'll only award you the prodigy title though once you're moving a car


----------



## Stiive (Nov 22, 2008)

PStechPaul said:


> Heh! Not bad. It's good to see some visible progress! With DTC, I assume that the pot setting will correspond to a certain amount of acceleration so the speed will increase until there is either enough drag to satisfy the torque setting, or the voltage (or current) limit of the power supply is reached?


Yeh basically... but the speed doesn't have to increase. Perhaps the rotor is locked; I can still apply any value of torque desired that the power stage is capable of providing.
If heavily loaded, the amount of torque would determine the angular acceleration. 

In the video, if I had more amps available, I could make the big fan go from full speed one direction, to full speed the other in a few ms. Or if i commanded 0.5Nm torque, the load would have accelerated as in the video, however if i had of commanded 9Nm torque as I did, the load would have accelerated much faster to its maximum speed as determined by the voltage, or overspeeded.


----------



## Stiive (Nov 22, 2008)

jhuebner said:


> This is good progress! Congratulations on getting something that complex to work.
> I'll only award you the prodigy title though once you're moving a car


Haha thanks Johannes, though the code is anything but complex, took about 3 days to write (including learning the ARM processor), the hardware OTOH took about 2months and many hours! 
I had heard that DTC will make the motor sound awful, sounds alright to me at these lower powers so far. I wouldn't mind writing a FOC one now too for comparison, though that'll be a bit harder, maybe i'll jump on with the Tumanako guys, though I hate working out and debugging other peoples code :s



jhuebner said:


> I'll only award you the prodigy title though once you're moving a car


Awwww, thats sucks... I don't plan to put this in an EV, ever. Maybe ill give it to someone in Melbs doin a conversion once its done and then see it moving a car  That's if 30kW is enough... Maybe they can use on the the spare boards to populate another, and go dual industrial motors overclocked to 30-40kW each.

I'm looking at providing some decent power to it this Friday, but it means i'll have to load all my programs onto a laptop for re-programming on the fly, cus i have no idea what motor ill be running. Scary.


----------



## Siwastaja (Aug 1, 2012)

First, congratulations! I'm still at V/f...



Stiive said:


> Awwww, thats sucks... I don't plan to put this in an EV, ever.


Then, how about publishing the source, I will try to do an FPGA version and a working SW code would be a great reference. (We already have current tranducers, power stage etc.). And, I'm starting to feel I understand FOC and DTC "well enough" at this point so we could just do it like you did, but on FPGA just for fun.... Anyway, that will be public too! And we will put it on an EV.


----------



## Stiive (Nov 22, 2008)

Siwastaja said:


> Then, how about publishing the source, I will try to do an FPGA version and a working SW code would be a great reference. (We already have current tranducers, power stage etc.). And, I'm starting to feel I understand FOC and DTC "well enough" at this point so we could just do it like you did, but on FPGA just for fun.... Anyway, that will be public too! And we will put it on an EV.


Yeh plan is to publish the source, I'm working on a website to host everything.
My source wouldn't be much help for an FPGA version though, the only part that will be relevant would be the actual DTC code which is a very small part. 

I'm happy to help you write it if you get stuck, just read a few DTC papers, most explain the concept very well. You might as well understand it, itd be useful for debugging


----------



## Stiive (Nov 22, 2008)

Siwastaja said:


> We already have current tranducers, power stage etc.


IMO hardware design is the most important part in DTC, I spent 2+ months doing schematic, selecting ideal components, and PCB design.
You have very fast sampling and switch speeds, you really need good PCB design for the digital not to interfere with the analog.
Any error in measurements very quickly leads to integration runaway (if using the easier integration method). 

After calibration my current measurement noise band is less than 0.02A, and similar with voltage. ATM my sample time is 50uS, and I'm taking 480cycles (maximum allowed) ADC readings at a prescaler of 2 (84mhz), I'll have to reduce this when I reduce my sampling rate to sub 10uS.

I tested two more motors last night on a dyno to test my torque estimators, that was good fun. I've never met a motor i couldn't turn 


Now to add in the advanced features such as speed estimation and DSVM. Probably time to close this thread though because the controller is pretty much finished. If anyone has any questions, email me (email address is on my PCB)


----------



## Siwastaja (Aug 1, 2012)

Stiive said:


> IMO hardware design is the most important part in DTC, I spent 2+ months doing schematic, selecting ideal components, and PCB design.
> You have very fast sampling and switch speeds, you really need good PCB design for the digital not to interfere with the analog.


Yeah, this is why I opted for a very small PCB directly mounted to the current transducer - so the transducer has a 10mm long route directly to the input of a differential 13-bit ADC (- input is connected to Vref output of the transducer, + input to the actual output). This small PCB has an isolated DC/DC converter as a power supply, and the digital communication is optoisolated. Then this PCB can be enclosed in metal casing. So I _think_ this is about the best immunity we can get -- we keep the analog part as physically small and isolated as possible. The modularity is good here, too.

What I'm worrying about is whether our transducers react quickly enough (HTFS 200-P) or our ADC (MCP3301, very cheap) is quick enough at 100 ksps.

But I don't want to hijack your thread! You have it working, we are still mostly at the planning stage.


----------



## Stiive (Nov 22, 2008)

Siwastaja said:


> Yeah, this is why I opted for a very small PCB directly mounted to the current transducer - so the transducer has a 10mm long route directly to the input of a differential 13-bit ADC (- input is connected to Vref output of the transducer, + input to the actual output).
> This small PCB has an isolated DC/DC converter as a power supply, and the digital communication is optoisolated. Then this PCB can be enclosed in metal casing. So I _think_ this is about the best immunity we can get -- we keep the analog part as physically small and isolated as possible. The modularity is good here, too.


Sounds alright. Make sure the opto comms is going to be fast enough, but that should be an easy task. You may want to add a linear reg and maybe a filter after the DC/DC converter to reduce switching noise.



Siwastaja said:


> What I'm worrying about is whether our transducers react quickly enough (HTFS 200-P) or our ADC (MCP3301, very cheap) is quick enough at 100 ksps.


100ksps is 1 sample per 10uS. Maybe a bit slow depending on what u want the controller to do.
I'd say 13bit is overkill, 12bit and a bit faster would be fine, but not crucial. You have to set your own specs

Current transducer seems fine, what power levels you looking at?


----------



## stickytechnology (Sep 19, 2010)

That's awesome, Stiive! Very nicely done, and such quick progress. Good luck with scaling the power.


----------



## Stiive (Nov 22, 2008)

Got it hooked up to a donated 140V LiPo pack now... Now we're making torque! Still need moar volts to get decent power out of this 415V motor, will prob overclock it this weekend.
DTC sound is starting to come through now though. . Decibels seem to vary with flux :s

Got the auto-tune working just in time too, going to go test it with about 10 different motors tomorrow, including a beast BLDC I hope. The auto-tune works well, but my BLDC code is untested so far. More concerned about IMs though, much cheaper and easy to come by.


Its all starting to come together really nicely. I'll post a proper video soon. Maybe.


----------



## Stiive (Nov 22, 2008)

Well, testing today went very well...

Played with a small 4-pole motor, and slowly increase the DC bus to ~400V. No hiccups.

Attached the Scott Drive BLDC motor AND IT SPUN! That was exciting, considering it was sensorless and I havn't even written my BLDC code yet. We only applied 50V though as the stator resistance is so slow and I currently have audio wire as the phase leads  Didnt want to change the leads over cus i have 10 turns through my current transformer. Will write BLDC code and try another day with 400V, _and _change the phase output leads.

Ran a *300hz *10kw IM at 400V to *20,000* *RPM*. That was also fun! 

With a proper supply the controller can produce some serious torque! A little 0.6kw motor becomes so powerful you can't lock the rotor by hand starting at about 200V. You can change direction 4000RPM to -4000RPM instantaneously with a jump of the motor.

Unfortunately with the 300hz machine we hit my pre-programmed current limit of 30A. I'll have to remove that and upgrade the phase leads and go back. Oh, and write some BLDC code


----------



## jhuebner (Apr 30, 2010)

wow! this sounds awesome. I wonder whether it works with my hardware setup but doubt it 

Do you do any analog low pass filtering of the current at all?


----------



## Stiive (Nov 22, 2008)

jhuebner said:


> Do you do any analog low pass filtering of the current at all?


No, not currently, seems to work well without. Though I do have a space on my PCB for a small cap in case I end up deciding I need it.

The crucial part is to use high quality components, any offset/error/noise in the measurements quickly lead to estimator runaway and a stalled motor.


I'm rapt that it spun the motor at 20,000 RPM without any glitches, because it proves that the estimators are working well and the sector/quadrant and therefore flux estimator is spot on.


----------



## smpavlik (Mar 28, 2011)

Can you please share your schematics? I've already PM my email.


----------



## Stiive (Nov 22, 2008)

smpavlik said:


> Can you please share your schematics? I've already PM my email.


Ah last time you didn't include your email.
PM'd


----------



## stickytechnology (Sep 19, 2010)

Hi Stiive,

Any news on your controller? Somewhat related, I picked up an ABB ACS800 on EBay, which is one of the few commercial drives that uses DTC (ABB holds one of the key patents) Anxiously looking forward to its arrival....


----------



## Stiive (Nov 22, 2008)

stickytechnology said:


> Hi Stiive,
> 
> Any news on your controller? Somewhat related, I picked up an ABB ACS800 on EBay, which is one of the few commercial drives that uses DTC (ABB holds one of the key patents) Anxiously looking forward to its arrival....


Ah nice one, you going to upgrade the power stage? You'll need to somehow up the current and/or OV limit(s).

Yeh my controller is going well. 
Tested basically as much as a could with my previous version, it was spinning my Siemens 1PV5135 very well - so now time for the next revision with more smarts and power.

At the moment i'm testing a test board before finalising design of StiiveDriiveV2  Basically just got a few different circuits on it, of which I was unsure of the best method for my application - so thought i'd try them all.
Also testing data logging on SDHC, plus WiFi connectivity, USB OTG and some other stuff. I guess this board will probably act as a sort of VCU after testing is complete since it already has everything required; namely TPS+CAN interface.

Plan is to have the new controller working in just over a months time... Well, we'll see what Hofstadter has to say about that.

How are your endeavours going?


----------



## Hollie Maea (Dec 9, 2009)

Stiive said:


> Plan is to have the new controller working in just over a months time... Well, we'll see what Hofstadter has to say about that.


 how many iterations have you taken it into account so far?


----------



## Stiive (Nov 22, 2008)

Hollie Maea said:


> how many iterations have you taken it into account so far?


Just 1. I live on the extreme! 
Hofstadter is gonna kick my arse.


----------



## Hollie Maea (Dec 9, 2009)

Well, even the stuff you have already completed is plenty impressive. I am just getting started on my controller project (for a "ford Siemens" motor). Now that you have had one go around, what would you recommend for a micro controller choice?


----------



## Stiive (Nov 22, 2008)

Hollie Maea said:


> Well, even the stuff you have already completed is plenty impressive. I am just getting started on my controller project (for a "ford Siemens" motor). Now that you have had one go around, what would you recommend for a micro controller choice?


I'm actually just looking at upgrading my MCU.
I would look for highest clock possible, DSP, and FPU is a must.
I'm thinking one of the hybrid FPGA+DSP - though might just be the STM Cortex M4 again since I already have the code written. There's going to be something special about the next revision - details in a month or so.

Also, the Siemens motor is an absolute bitch to spin correctly (well, sensorless anyway), and she sucks current - your code has to be perfect otherwise she'll blow an IGBT for sure. I'd look at starting with something a bit smaller with higher resistance/inductance.


----------



## stickytechnology (Sep 19, 2010)

The ABB I got is a 500V drive, so it'll work from 307--877 V on the DC link, which is a really nice range for using a 220V motor.

It's a 25kW model, so should drive the car as-is, but yeah, I do see a power stage upgrade in my future 

My main endeavors right now are family and work for pay, so not much on the car, but my impulsive EBay finger couldn't pass up this drive...


----------



## Hari (Mar 25, 2014)

Hi,
I am new member . I am doing M.Tech in automotive electronics and embedded system(AE&ES) from ARAI,pune

My project is to develop C code for DTC controlof Induction motor and to calculate actual torque and refernce torque on two different core independently on a multicore microcontroller

Can u please suggest some multi-core controller that supports this

Thanks and Regards
Hari S Pillai


----------



## Hari (Mar 25, 2014)

Stiive said:


> I have got my C code running my induction motor flawlessly using the Induction motor on SimPowerSystems. To reduce costs, my plan is to use a couple of fast micro controllers to run the code (one for d-q transforms and one for lookup) as i have eliminated all FFT and therefore hopefully will be fine without a DSP.
> 
> I have some 600V 600A IGBTs that i'll probably end up using, depending on the final design.
> 
> ...


Can u tell which controller you are using and can u share the c code because i am working on similar project.

Thanks again


----------



## Hari (Mar 25, 2014)

Stiive said:


> JR,
> 
> I was looking at using 2 80mhz MCU demo boards. Alot of the data can be sent in parallel using a few ports each and would just be the output of the hysteresis controllers (0-4), flux sector (0-5) and angle (if you are familiar with DTC operation). Other information for debugging or advanced features can be sent in serial.
> Because the control is SVM, this is perfect for two processors (or dual core),



Are you using two microcontrollers ?? If you connect two microcontrollers will it work as dual core?? how large amounts of dat transfer is possible between two??
please help


----------



## Hari (Mar 25, 2014)

how will you generate pwm to control IGBts??

can you tell the code for PWM generation??


----------

