Forums

model for BLDC motor control with PWM

Started by alb March 12, 2015
Hi everyone,

I've an half H-bridge motor driver controlled via a PWM. We read current 
on the phase terminal and regulate the PWM accordingly through a PID.

The exercise is to play with all parameters (transfer function, sampling 
frequency, adc resolution, pwm resolution) in order to get the right 
precision on the output.

I wanted to model the loop with something like MATLAB or Octave, but I'm 
not very proficient in neither of the two, any advice on how to proceed?

I've Octave installed on my *nix box and I started playing with it, but 
I believe these kind of models have elementary functions that can be 
reused nearly as is. Any pointer or suggestion?

How would I model the half bridge and the motor response? would a simple 
gain and phase shift be sufficient? Should I take into account the 
mechanism dynamic? And how much such a higher fidelity model would be 
essential?

Thanks a lot,

Al

p.s.: anyone knows any integrated circuit for the h-bridge that is space 
rated?

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
On 12/03/2015 17:36, alb wrote:
> Hi everyone, > > I've an half H-bridge motor driver controlled via a PWM. We read current > on the phase terminal and regulate the PWM accordingly through a PID.
What do you mean with "half bridge" driving a BLDC motor ? the power side arch is well known nowadays, 6 MOSFETS are required to drive the 3 BLDC phases. BTW is it a Hall Effect sensor BLDC ?
> > The exercise is to play with all parameters (transfer function, sampling > frequency, adc resolution, pwm resolution) in order to get the right > precision on the output. > > I wanted to model the loop with something like MATLAB or Octave, but I'm > not very proficient in neither of the two, any advice on how to proceed? >
Many years ago (2009) when i was project manager at ASTEELFLASH I have been dealt with that sort of questioning .... you are wasting your time trying to find any universal electro-mechanical model for that sort of things (Torque(Current), RPM(Voltage) ...etc). You must characterize the BLDC for your own for building a decent EM "model" and believe me it not nothing ! After some nights hard working ;-) ... afterwards you can have a chance for a PID (which is very easy) BTW i remeber we have been using a Freescale DSC56F80XX for the BLDC controller.
> I've Octave installed on my *nix box and I started playing with it, but > I believe these kind of models have elementary functions that can be > reused nearly as is. Any pointer or suggestion? > > How would I model the half bridge and the motor response? would a simple > gain and phase shift be sufficient? Should I take into account the > mechanism dynamic? And how much such a higher fidelity model would be > essential? > > Thanks a lot, > > Al > > p.s.: anyone knows any integrated circuit for the h-bridge that is space > rated? >
There's a technique to model a motor in pspice in this ancient apps note:
www.it.uom.gr/project/digital/appnts.pdf

It was useful for simulating a motor driver design (~ 20 years ago).


On Thu, 12 Mar 2015 16:36:52 +0000, alb wrote:

> Hi everyone, > > I've an half H-bridge motor driver controlled via a PWM. We read current > on the phase terminal and regulate the PWM accordingly through a PID. > > The exercise is to play with all parameters (transfer function, sampling > frequency, adc resolution, pwm resolution) in order to get the right > precision on the output. > > I wanted to model the loop with something like MATLAB or Octave, but I'm > not very proficient in neither of the two, any advice on how to proceed?
Just how much are you modeling? It's good practice, when you can get away with it, to keep your current loop bandwidth well above your position loop (or speed loop, or whatever) loop bandwidth. If you can do this, then it turns out that a pretty good tool for simulating the behavior of a motor of this sort is an H-bridge driving a coil (possibly lossy) in series with a voltage source. The coil models the motor winding inductance and the voltage source models the motor back EMF. The real drawback with Spice is that you have to model the behavior of your microprocessor's control loop with circuit elements, but that can be overcome (LTSpice, if you dig for it, has elements that help out with generating PWM. I generally make a sawtooth oscillator and then use coupled voltage sources and comparators, at least when I have to go that deep). The NICE thing about Spice is that at the level of detail of your current loop, you care about things like how your deadband affects the linearity of the loop, and whether you're going to pop your FETs, and other things that -- with a properly designed current loop -- you shouldn't be able to affect at the next outer layer of control.
> I've Octave installed on my *nix box and I started playing with it, but > I believe these kind of models have elementary functions that can be > reused nearly as is. Any pointer or suggestion?
If you decide to use one of these, search help on "ode" (ordinary differential equation). There should be solvers. If you don't have to interact with any Matlab users, I recommend Scilab. It's a personal preference, but Scilab was authored by a group that does control systems work -- it's almost literally a Matlab offshoot that was designed for and by control systems engineers. In any of these three, in general you need to cast your differential equation in the form dx/dt = f(x, u, t) where x is your state vector, u is your input vector, and t is time. The function f(x, u, t) defines the behavior of the system. You whomp up f, give it to the solver along with the initial value of x, a vector of times, and the input value for each of those times, and the solver goes off and does it's business.
> How would I model the half bridge and the motor response? would a simple > gain and phase shift be sufficient? Should I take into account the > mechanism dynamic? And how much such a higher fidelity model would be > essential?
I don't know how you would do this, because I'm not you. I've never found a One True Way to model stuff. A model that takes everything into account is so complex, opaque, and slow that you may as well just work with the real system. A model that's simple enough to work with never seems to fit the next problem that comes along. In your shoes, I think I'd model the current loop in LTSpice, then if I needed to, model the next outer loop in Scilab, using a behavioral model of the motor/driver that's designed from characterizing either the real motor or the Spice model.
> Thanks a lot, > > Al > > p.s.: anyone knows any integrated circuit for the h-bridge that is space > rated?
Nope. Sorry. If you were at the stage of choosing microcontrollers and designing circuits I'd suggest that you choose a microcontroller that has full six-terminal BLDC motor facilities, and cook up your own drive circuit from gate drivers and FETs. I don't know if you can or want to do that at this point, though. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 13/03/2015 18:34, Tim Wescott wrote:
> Just how much are you modeling? It's good practice, when you can get away > with it, to keep your current loop bandwidth well above your position loop > (or speed loop, or whatever) loop bandwidth. If you can do this, then it > turns out that a pretty good tool for simulating the behavior of a motor > of this sort is an H-bridge driving a coil (possibly lossy) in series with > a voltage source. The coil models the motor winding inductance and the > voltage source models the motor back EMF
For motors 1- Torque(I) with nominal voltage, 2- RPM(Voltage) for no mechanical load (to compensate intrinsic mechanical friction), It's wise to know where to go in order to build a real PID for speed regulation, the knowledge of the above for a BLDC motor is essential ; no way. No need complex simulation models for understanding or simply doing the job (simulink, MATLAB ...etc.). Please don't be offended. Habib.