mxlemming
Power poster
- Joined
- Jul 17, 2020
- Messages
- 1,310
A long time back, I wrote a post about examples for DTC (Direct Torque Control insights and examples?). I never got any practical implementation for it, and never really understood it… until now.
There were a few things thing that always held me back from making progress on this…
1) the information available is incredibly sparse; what there is is generally copypasta from the last copypasta, ABB are definitely not letting on the pertinent details despite extensive “app-notes”, and pretty much all the papers are based on MatLab/Simulink… vanishingly few real world examples.
2) You really need extremely good hardware to implement this. I tried a few times to make attempts on typical commercial hardware, and generally found that the current sense aberration was either too much, or low side shunt, and on my own hardware, I was almost exclusively using low side shunts, which it turns out cannot be meaningfully used for DTC. I had a few phase ring devices, but on those the accuracy was still not good enough – the kicker being, FOC is absolutely fine with very mediocre current sensors! It is intrinsically a low pass filter.
This changed when recently I made some hardware (sorry, no pics of the hardware, confidential for a client...)for a Dynamesys project where the main focus, rather than being power density or tiny size was extreme accuracy, for analytics. Suddenly (after a month of focused design and optimization) I had hardware that could run with the noise and accuracy and parasitic aberration in the last few LSB of the ADC… after making the DTC algorithm for this hardware and debugging all the complexities, I was able to port it to some older bigger hardware, and with extended hysteresis bands it worked OK. Many bits of hardware I tried it on were just totally hopeless though.
Secondly, various sources say DTC is intrinsically sensorless… This is true… for an induction motor where you actually can directly control the flux angle... For a PMSM, it simply is not the case, you require further algorithms to detect where the flux is.
3 torque states (too high, too low, about right) and
6 “sectors” or 60 degree segments of electrical angle, therefore 36 output possibilities. These are each assigned one of 8 combinations of high or low for the 3 phases (8 options; V0-V7).
So the flow for PMSM becomes:
1) Know the angle a-priori (this is the hard bit if you have no encoder)
2) Determine the sector
3) Measure currents
4) Determine if the torque current or flux current (if applicable) is too high or low
5) Choose the right combination of phase high or low from the table (the switch state)
6) Wait some period of time before repeating.
With that understanding, some very painful stm32 peripheral setup and some exceptionally good hardware… here we have sensorless DTC on a PMSM.
Speed is comparable to FOC with full modulation. Torque is equivalent for a given current. The hysteresis bands means that there is a bit of a dead zone around zero current, which isn’t so important for traction but for precision control is a bit of a problem.
Switching frequency… it is lower generally, but totally unpredictable and varies motor to motor and with the hysteresis bands.
Torque ripple is basically identical to FOC, the dominant factor is the inherent motor non uniformity for almost all cases. The ripple is on the order of kHz so it is basically unimportant from a torque perspective – another nonsense copypasta debunked. It might be an issue with servo control… BLDC has a ~15% torque ripple if driving a sinusoidal motor, DTC and FOC have a torque ripple at the switching frequency.
At full speed:


At mid speeds:


You can see from the above shots that the switching is totally asynchronous, there is no PWM modulation, just on and off as and when the controller decides there is a need to change.
Probably not. It has some inherent advantages over FOC, such as lower (but indeterminate) switching speed, but this is at the expense of nasty noise and hardware complexity. A well optimized FOC can probably outperform it. There are definitely applications where I can see this being a preferable option, such as things that have extreme impact loading, since it seems very hard to trip compared to FOC.
Someone will probably ask if this is open source. Unfortunately, in this day and age of AI scraping github, it makes little sense to open source it; I would just end up maintaining a project the AI trains itself on. Sad times…
Hope this was interesting to someone.
There were a few things thing that always held me back from making progress on this…
1) the information available is incredibly sparse; what there is is generally copypasta from the last copypasta, ABB are definitely not letting on the pertinent details despite extensive “app-notes”, and pretty much all the papers are based on MatLab/Simulink… vanishingly few real world examples.
2) You really need extremely good hardware to implement this. I tried a few times to make attempts on typical commercial hardware, and generally found that the current sense aberration was either too much, or low side shunt, and on my own hardware, I was almost exclusively using low side shunts, which it turns out cannot be meaningfully used for DTC. I had a few phase ring devices, but on those the accuracy was still not good enough – the kicker being, FOC is absolutely fine with very mediocre current sensors! It is intrinsically a low pass filter.
This changed when recently I made some hardware (sorry, no pics of the hardware, confidential for a client...)for a Dynamesys project where the main focus, rather than being power density or tiny size was extreme accuracy, for analytics. Suddenly (after a month of focused design and optimization) I had hardware that could run with the noise and accuracy and parasitic aberration in the last few LSB of the ADC… after making the DTC algorithm for this hardware and debugging all the complexities, I was able to port it to some older bigger hardware, and with extended hysteresis bands it worked OK. Many bits of hardware I tried it on were just totally hopeless though.
So what is DTC and what are the copy-pasta misconceptions?
Firstly, DTC is inherently an induction motor technique. DTC = Direct Torque (and Flux) Control. It does not naturally apply to PMSM motors. The idea is that the algorithm integrates the voltage applied to determine the flux, and then applies more voltage in line with this flux to increase flux and more voltage in quadrature to increase torque current (where torque = flux*quadrature current). Since in an induction motor you can change the flux… this makes sense. For a PMSM, you require a-priori knowledge of the flux location – an encoder/sensorless algorithm… which fortunately I have/am good at.Secondly, various sources say DTC is intrinsically sensorless… This is true… for an induction motor where you actually can directly control the flux angle... For a PMSM, it simply is not the case, you require further algorithms to detect where the flux is.
What is the switching table? This is a table with inputs:
2 flux states (to high and too low) and3 torque states (too high, too low, about right) and
6 “sectors” or 60 degree segments of electrical angle, therefore 36 output possibilities. These are each assigned one of 8 combinations of high or low for the 3 phases (8 options; V0-V7).
So the flow for PMSM becomes:
1) Know the angle a-priori (this is the hard bit if you have no encoder)
2) Determine the sector
3) Measure currents
4) Determine if the torque current or flux current (if applicable) is too high or low
5) Choose the right combination of phase high or low from the table (the switch state)
6) Wait some period of time before repeating.
With that understanding, some very painful stm32 peripheral setup and some exceptionally good hardware… here we have sensorless DTC on a PMSM.
How does it compare to FOC?
Firstly, the noise. It is nasty compared to FOC, like a white noise sizzling sound. It almost sounds broken. At high speed, or with a heavy motor, it is not so bad but for a light shelled low inductance drone motor it is icky.Speed is comparable to FOC with full modulation. Torque is equivalent for a given current. The hysteresis bands means that there is a bit of a dead zone around zero current, which isn’t so important for traction but for precision control is a bit of a problem.
Switching frequency… it is lower generally, but totally unpredictable and varies motor to motor and with the hysteresis bands.
Torque ripple is basically identical to FOC, the dominant factor is the inherent motor non uniformity for almost all cases. The ripple is on the order of kHz so it is basically unimportant from a torque perspective – another nonsense copypasta debunked. It might be an issue with servo control… BLDC has a ~15% torque ripple if driving a sinusoidal motor, DTC and FOC have a torque ripple at the switching frequency.
At full speed:


At mid speeds:


You can see from the above shots that the switching is totally asynchronous, there is no PWM modulation, just on and off as and when the controller decides there is a need to change.
Overall would I recommend it?
Probably not. It has some inherent advantages over FOC, such as lower (but indeterminate) switching speed, but this is at the expense of nasty noise and hardware complexity. A well optimized FOC can probably outperform it. There are definitely applications where I can see this being a preferable option, such as things that have extreme impact loading, since it seems very hard to trip compared to FOC.
Someone will probably ask if this is open source. Unfortunately, in this day and age of AI scraping github, it makes little sense to open source it; I would just end up maintaining a project the AI trains itself on. Sad times…
Hope this was interesting to someone.
Attachments
Last edited:
