Log in

View Full Version : Failed attempt to explain JAG linearity


vamfun
09-05-2009, 20:09
Once again I revisited the Victor non linearity phenomenon and tried to convince myself with some math and excel analyses that PWM and motor inductance/resistance and motor commutator characteristics are the cause. In the Sensorless BackEMF speed control thread I conjectured that the JAG linearity was due to its 15khz pwm. This was putting about 15 pulses per commutator segment (we think there are 10 segments) at max motor speed whereas the 120hz and 2khz victors were putting an 1/8 and 2 pulses respectively. I dedicated a day to a more detailed analysis to verify that this was the reason for the JAG linearity.

Well... all I did was show that the results are the same for all three controllers ..... but I finally was able to reproduce the nonlinear speed vs duty cycle curve that we all see with victors. This is a big discovery and represents a paradigm shift in getting me off of the pure resistive motor model when using a pwm drive.

The analysis computes a normalized motor current i_norm which results from an assumed L/R for a CIM01 and a given controller PWM Hz. Instead of assuming steady state without commutator segments, I let the pulses accumulate from a zero coil current for the number of PWM pulses that the commutator segment would see. This normalized current is then multiplied by the max current and set equal to the i_free current.

So i_free = (12 - Vemf)/R * i_norm

This leads to an equation for w/w_free=(1-i_free/i_stall/i_norm)/(1-i_free/i_stall).

i_norm does fall off with speed when the L=230uh (from an old thread) is used because of commutator effects. I ran a case with L=23uh and the falloff was negligible.

But the surprising result is that the 15khz doesn't seem to enter into the nonlinearity. So... I have replaced a nonlinear problem with a why linear problem:)

Enclosed is my Excel and if anyone wants to discuss it , I'd love to find a hole in my assumptions!!

POST NOTE:
If the L/R of the motor is small with respect to the the pwm period (like the 120hz Victor) or if the pwm period is small (like the JAG) and the commutator segment time is large with respect to L/R then

i_norm = duty is a good approximation.

So for the inductive motor model: i_free = ((12-Vemf)/R) *duty

Inductive model -> Vemf = 12 - i_free*R/duty (This holds for Vemf >0 else Vemf = 0 .)

So we have an inverse relationship with duty cycle.

The pure resistive model assumes that the motor input is a dc voltage = duty*12
i_free = (duty*12 - Vemf)/R

Resistive model-> Vemf = duty*12 - i_free*R

and we have a linear relationship to duty cycle.

vamfun
11-05-2009, 04:26
Here is a comparison of the inductive motor model with real data taken by the Beach Bots in 2007 I think. I used the CIM motor parameters , not sure what Victor but just adjusted the i_free to account for added friction from their installation. . Fit is within about 5%

Joe Ross
11-05-2009, 09:51
Here is a comparison of the inductive motor model with real data taken by the Beach Bots in 2007 I think.

It was a Victor 884.

When I read through the jaguar docs, when you get into the CAN modes, there is both a voltage control mode and a current control mode. There was no mention of a pulse width control mode. If the Jaguar was in voltage control mode, that might explain the speed linearity.

vamfun
11-05-2009, 15:45
It was a Victor 884.

When I read through the jaguar docs, when you get into the CAN modes, there is both a voltage control mode and a current control mode. There was no mention of a pulse width control mode. If the Jaguar was in voltage control mode, that might explain the speed linearity.

I believe the voltage control mode simply converts a voltage input to a pwm command. There are provisions for a reference voltage input from a pot as well. I don't believe there is any voltage feedback that is used in a PID loop..only encoder or current.

If you look at hbridge.c there is some code that does this conversion:
Here is an excerpt when the input voltage g_lHBridgeV is >0.....

// Compute the PWM compare value from the desired output voltage.
// Limit the compare value such that the output pulse doesn't
// become too short or too long.
//
ulCompare = (((32767 - ((g_lHBridgeV * g_lHBridgeVMax) / 32767)) *
SYSCLK_PER_PWM_PERIOD) / 32767);

g_lHBridgeVMax=32767 so this essentially says that


ulCompare = (1 - voltage/32767)*SYSCLK_PER_PWM_PERIOD

ulCompare then sets the HW registers to generate a gate pulse for a given number of system clock counts.

I don't fully understand how these compare registers work but I'm guessing ulCompare sets a counter threshold on a system clock pulse counter. So if the voltage is zero then the counter never trips and the gates remain off. If the voltage is max or 32767 cnts then the ulCompare is zero and the gates are always on. Anything in between sets the duty pulse width.

Al Skierkiewicz
12-05-2009, 07:45
Chris,
One of the things that has not entered into the discussion yet is...The brush assy contacts more than one commutator segment at a time. Although it is easier to see using a Victor, the current through the motor steps up and down as the brush assy crosses a commutator boundary. At any one point in time, you can have one or two windings in parallel.
Don't forget that at slow speeds, motor losses become the more predominant part of the model. Bearing friction, brush friction, load losses and magnetic field issues all need to be accounted for. It is very difficult to get the motor moving particularly with small duty cycles. As the motor approaches max speed, the back EMF becomes more dominant.

Gdeaver
13-05-2009, 08:07
The most likely explanation is that the input pulse time was mapped to the duty cycle output to provide a linear response. Luminary Micros probably did for us what allot of teams where already doing with the old controller.

vamfun
13-05-2009, 15:35
Timeout... I found a bad assumption in the excel that changes the speed curves but not the normalized current. Stay tuned.

vamfun
14-05-2009, 15:58
Dooh!!!

Both models are correct: the linear applies to the brake mode and the nonlinear to the coast mode.


The commutator, friction, pwm rates , motor inductance etc are all secondary distraction factors. The key is the darn protection diode in the off pwm pulse phase. Under simplifying assumptions, we can think of Vemf as a battery that is allowed to charge or discharge the motor coil. In the on phase, it is there for both the brake and coast mode. In the off phase, Vemf is only there for the brake mode where a current loop is created by switching on the lower legs of the H bridge. In the coast mode , these lower legs are switched off but there is a diode in the path instead. The diode essentially blocks Vemf from modifying the current once the current has reached zero and Vemf battery can be assumed removed from the ckt for most of the off phase. So in the coast mode we can replace Vemf with Vemf*duty. This leads to the two simple math equations I spoke of earlier. What I called the inductive model corresponds to the coast mode and the resistive model corresponds to the brake mode.

Brake mode: only 12 v chopped, Vemf present all the time so:

i_free*R = 12* duty -Vemf ---> Vemf = 12*duty - i_free*R ...................... linear with duty


Coast mode: both 12v and Vemf chopped

i_free*R = (12-Vemf)*duty --> Vemf = 12 - i_free*R/duty ........................varies inversely with duty


It is clearly a little more complicated than this, but these models capture the crux of the matter:

So all we need now is for someone to run the Victors and JAG in both coast and brake modes to see if theory holds up.

Hmmmmm how do I change the title of this thread:)

Doesn't someone owe me a beer?!

EricVanWyk
14-05-2009, 17:36
Doesn't someone owe me a beer!

Next time you are in Manchester NH, I will get you TWO beers.

Al Skierkiewicz
14-05-2009, 21:24
Chris,
Do not start checking the menu just yet. The back EMF is present all the time the motor is turning. It varies with angular velocity, the number of poles in the armature and the number of poles in the magnet structure. It is a critical component in the no load speed of the motor. At this speed, the back EMF and the supply voltage cancel and no additional current flows in the motor windings. Look at the curves for any of the kit motors, and you will see that free speed occurs at current minimum. Now, if you drive a motor to free speed and open the supply voltage, the back EMF is capable of generating current if and only if there is a circuit path in which it can flow. In any of our motors, if the controller is put in the coast mode and the drive is removed, the circuit exists through the motor, wiring, FET diodes and battery. Since the diodes have a finite voltage drop in the forward conducting state, 1.25 volts per diode, current will only flow when the EMF is higher than the battery voltage by 2.5 volts (two FET strings in series). This is only possible if the motor is driven from an external source. At full throttle, the motor is spinning at a rate that is determined by the 12 volt source. When that is removed, the EMF will be around 12 volts and not enough to turn on the diodes. So what happens? The motor slows down due to frictional losses and magnetic interaction.
In the brake mode, the FETs are turned on to produce a closed circuit with the motor series resistance, the wiring resistance and series resistance of the two FET strings. Since Rds ON is 5.5 mohms and there are three FETs per string, the series resistance is 5.5/3=1.8mohm times two strings in series is 3.6 mohm. Total circuit resistance is likely in the neighborhood of 20-30 mohms.
However, as you may have pointed out, at less than full throttle, the controller is essentially in coast mode when a FET string is not turned on during the PWM off time. Again, it is unlikely that the diodes in the FETs are turned on (forward biased) during this time. Should this occur, once the EMF in the motor falls below 12 volts+2.5 volts=14.5 volts, the diodes would turn off. This becomes even more complex because of the dual winding caused by the brush contacting more that one commutator and the fact that the two windings are not rotating through the magnetic field at the same angular phase. i.e. the two will not reach maximum EMF at the same time.
So think about this, Stall current on the CIM is specified at 133 amps. Let us assume that is for two windings since it is labeled maximum current. If the supply is 12 volts at the motor terminals, then using Ohm's Law, the motor series resistance works out to .09 ohms or .18 ohms per winding. The free load specification is 2.7 amps, again at max, so making a calculation, 0.243 volts would drop across the series resistance. Therefore at free speed, the back EMF would be 12+.243. An open circuit at that point would still not produce the required 2.5 volts to turn on the diodes. Now we are dealing with averages here so the inductance is not yet present in the calculations. Most certainly, the inductive spike is present for short periods of time. A scope would prove that during those times, the diodes do conduct and clamp the spike at 12 volts plus the diode forward voltage as you would expect.
So where does this all leave us? A quick check of the Jaguar manual says that the controller is designed for a very specific motor, i.e. the Mabuchi RS555 or the CIM. My suspicion is the motors were modeled and switching parameters set to optimize those motors. The manual goes on to say that other motor types may not behave the same and recommend the reader check the Brushed DC Motor Control Reference Design Kit (RDK) User’s Manual for more information on motor selection and use. If you have not downloaded that yet, it might prove to be very interesting.

vamfun
14-05-2009, 22:14
Al,
I'm aware of everything you mentioned and I'm not sure that any of it contradicts what I'm saying.

I wish it was easy to draw pictures...

All I'm saying Al is that I believe the JAG linear transfer function that has been posted must have been taken in the BRAKE ON mode. Other xfer functions posted with Victors etc that are nonlinear were taken with the COAST ON mode.

Assume for discussion that the motor current is being driven positive during the PWM "on" phase.
In the brake mode, the "off" PWM phase places the low side FET's ON and essentially shorts the coil which provides a path for the current to drive toward -Vemf/R as a steady state and can reverse the current in the coil. In the coast mode, as you say, the low side FET's are OFF and the diodes are active. The diode will only conduct until the current drops to zero and then shuts off so Vemf cannot drive the current negative. So for most of the time , even though Vemf is there, it is not active in the calculation of current while in the "off" PWM phase for the coast mode. It is this that makes the difference. So my simple math model just assumes that Vemf is only present during the "on" PWM when operating in the coast mode but it does a great job of matching actual test data.

I am conjecturing that this is true for all the controllers we see in Vex and FRC. My experience with Vex motors tells me that they are coast mode since they have the same characteristic as the Victor nonlinear curve I posted earlier from Beach Bots. When I built the Vex Bbot inverse pendulum robot (http://youtube.com/watch?v=4loT_Xfhvbk
), I spent a lot of time modeling the problem with MATLAB and was always disappointed when my optimal control theoretical gains did not match the gains actually needed. Most of the problem came from the nonlinear Vex motor gain and frictional dead zones anomalies. Ohhh how I wish I had a Vex motor with an H bridge in the brake mode. I am currently working on a Vex unibot that is stable in two axes and balances on one wheel and already have had numerous failures from sticky nonlinear motors.

My suspicion is the motors were modeled and switching parameters set to optimize those motors. The manual goes on to say that other motor types may not behave the same and recommend the reader check the Brushed DC Motor Control Reference Design Kit (RDK) User’s Manual for more information on motor selection and use.

I have spent some time with the RDK and it may be optimized for the CIM re matching the bridge dynamics , but I'm guessing that a transfer function run in the coast mode will be nonlinear. There might be some SW optimization but I suspect this is only for the current and encoder PID's. As I posted earlier to Joe Ross, the voltage control mode looks like a straight forward PWM motor controller that just puts out a PWM signal proportional to a voltage reference.

Al Skierkiewicz
15-05-2009, 07:24
Chris,
During the time that valid drive signals are being converted to output, the brake and coast mode is not enabled. The selected mode only takes place when the input PWM goes to 127 or neutral value. Think about that time when the the throttle is just off the center position. The motor gets a very short pulse of output voltage. If the controller was in the brake mode during the off period, the motor would not turn very much. That is obviously not the case.
As an off season project for a team, I would like to see the test results of CIM motor linearity plotted for different loads. It would need to compare the linearity of the CIM at the max efficiency point, and several points on both sides as the motor approaches free speed and stall.
When teams report trouble tuning PID loops, I always wonder what else might be at play. As you know, things like non-linear frictional loss, gear backlash, motor bias, production variances in motors, misalignment of drive train shafts, minimum resolution on sensors and chain wear are all things that contribute to problems with achieving desired response.

vamfun
15-05-2009, 15:43
Chris,
During the time that valid drive signals are being converted to output, the brake and coast mode is not enabled. The selected mode only takes place when the input PWM goes to 127 or neutral value

This is why we need you in these forums Al.. Very good point. My memory of the hbridge.c was a little fuzzy... they only go to the BRAKECOAST when voltage in is zero or when the limit switches are tripped.

Darn... I was hoping to be done with this. I might drink Erik's beers anyway just to help me forget this problem.

So where does this leave us? Let me think outloud with the new ground rules:

It all hinges on the "off" PWM current. We have a low FET "on" and the rest "off". Any current flow must now pass through a protection diode. As long as the diode can conduct, the current is heading toward a steady state value of -Vemf/R (assuming positive current during the "on" PWM drive). If the L/R is short with respect to the PWM period, the current decays quickly and is zero for most of the off phase. So the average current for the whole pulse is determined by the area under the "on" pulse which = (12-Vemf)/R*duty. This would be the case for the slow Victors and we would expect a nonlinear response equal to my old coast formula.

For the JAG, the L/R is large relative to the PWM period. If the current cannot decay to zero during the "off" phase, it will continue to accumulate until the average current stabilizes. Since the current never gets below zero we can consider the problem as the superposition of a steady state Vemf and a pulsed 12v. And this leads us to the linear equation = (12*duty -Vemf)/R .

SOOOO...I think the two formulas are ok but now it would be due to the 15khz JAG vs the slow Victors. I didn't see this in my previous excel because I assumed the steady state current was heading towards zero in the "off" state instead of -Vemf/R.

TODO: rerun excel with revised off current and see if I can verify the above
Stay tuned again. I'm determined to collect my beers:)

Al Skierkiewicz
15-05-2009, 16:07
Chris,
The diodes only conduct when the EMF is higher than 2.5 volts above the battery voltage. This will only occur (theoretically) during the inductive spike. The EMF is lower than the applied voltage except if the motor is supplied mechanical speed at greater than the applied voltage would produce. You also want to consider that the current only flows when a circuit is closed. Once the diodes stop conducting, there is no where for the current to flow. Open circuit voltage rules apply, even though the difference is small. I think that actually works in your favor if you are considering high impedance voltage monitoring. I have no specifications on the inductance of the motors. However the L/R equations go out the window with no current flow don't they?

vamfun
15-05-2009, 18:59
Chris,
The diodes only conduct when the EMF is higher than 2.5 volts above the battery voltage. This will only occur (theoretically) during the inductive spike. The EMF is lower than the applied voltage except if the motor is supplied mechanical speed at greater than the applied voltage would produce. You also want to consider that the current only flows when a circuit is closed. Once the diodes stop conducting, there is no where for the current to flow. Open circuit voltage rules apply, even though the difference is small. I think that actually works in your favor if you are considering high impedance voltage monitoring. I have no specifications on the inductance of the motors. However the L/R equations go out the window with no current flow don't they?

Well, my assumption is that during the "off" phase the inductive spike keeps the voltage high enough to turn on the diodes. This condition remains until the current goes to zero at which time we have an open ckt condition with no current. If the current does not make it to zero before the next "on" pulse then a closed ckt was there for the whole off phase.

I am not fooling with the diode drops yet because I think they are secondary effects. I also think there is only one diode in the picture, since it looks like they keep the lowside FET in ON state and feed the pwm pulse to the High side FET on the other side of the motor.

I will probably wind up just doing a simple hbridge simulation and run it.

Al Skierkiewicz
16-05-2009, 15:02
Chris the diodes only conduct when the forward bias is high enough to turn them on. As soon as the bias falls below the 1.25 volts per diode, they stop conducting. Remember that the diodes are also back biased by the battery so the motor EMF must be higher than the battery voltage.

vamfun
16-05-2009, 15:13
It all hinges on the "off" PWM current. We have a low FET "on" and the rest "off". Any current flow must now pass through a protection diode. As long as the diode can conduct, the current is heading toward a steady state value of -Vemf/R (assuming positive current during the "on" PWM drive). If the L/R is short with respect to the PWM period, the current decays quickly and is zero for most of the off phase. So the average current for the whole pulse is determined by the area under the "on" pulse which = (12-Vemf)/R*duty. This would be the case for the slow Victors and we would expect a nonlinear response equal to my old coast formula.

For the JAG, the L/R is large relative to the PWM period. If the current cannot decay to zero during the "off" phase, it will continue to accumulate until the average current stabilizes. Since the current never gets below zero we can consider the problem as the superposition of a steady state Vemf and a pulsed 12v. And this leads us to the linear equation = (12*duty -Vemf)/R .

SOOOO...I think the two formulas are ok but now it would be due to the 15khz JAG vs the slow Victors. I didn't see this in my previous excel because I assumed the steady state current was heading towards zero in the "off" state instead of -Vemf/R.



OK, finished my TODO and have verified that linearity is indeed due to the higher frequency of the JAG. Based upon my quoted rationale we can show that

120Hz Victor v_emf = 12 - i_free*R/duty......................varies with 1/duty

15kHz Jag v_emf = 12*duty - i_free*R .....................varies with duty

The 2kHz Victor is very close to the Jag.


I wrote a LABVIEW simulation (see attch hbridge.vi) of a one sided Hbridge and the curves (see attch thumbnail) verify what we are seeing. As Al says, this is independent of coast or brake mode however, with the JAG, the "off" ckt is essentially the brake mode since the diode is always conducting..the only difference is for the voltage drop across the diode. This is why I did not see any non spike Vemf in the JAG waveform ..only duty cycle variations.

Feel free to run the program and vary the inductance to see its effects. I used a nominal 120uh which is close to what people have measured in the past. I think the max posted was 230uh.



I wonder what all this is worth? Since I have not seen this mentioned in any of the Hbridge tutorials maybe I'll publish a paper. Lets see...what should I call it. How about

"Special Theory of Nonlinearity: An Inconvient Truth of Low Hz Hbridges".

Maybe the good folks in Stockholm are reading ChiefDelphi threads:)
Well, it might be worth a minor entry to Wikipedia under Hbridge theory
or under alternative ways to spend time when Friday night TV is on.


Erick...put those beers on ice...assuming Al doesn't send me back to the showers again.

RIP thread ;

Mr. Lim
16-05-2009, 15:33
RIP thread ;


Maybe not so fast :o.

We programmers now are dying to know how we can save ticks and optimize everything now.

Would it be prudent to suggest we can take these results, and figure out a minimum PWM frequency that will give us a "linear" response for all of our FRC motors?

And another question, a Jaguar will accept a 120Hz PWM signal, and if it does, will it behave in the same non-linear fashion as the Victors?

Joe Ross
16-05-2009, 17:40
t we can take these results, and figure out a minimum PWM frequency that will give us a "linear" response for all of our FRC motors?

And another question, a Jaguar will accept a 120Hz PWM signal, and if it does, will it behave in the same non-linear fashion as the Victors?

The pwm frequency that is being discussed here is the output of the speed controller and is completely independent from the input.

Al Skierkiewicz
17-05-2009, 18:07
OK,
I thought it was time to make a chart, so here is a spreadsheet and chart. I took the values that have been mentioned here although they are not taken from published data. In calculating motor current, I simply took the motor winding resistance and stated inductance and plotted the result against duty cycle. Please note that I also multiplied the 15kHz values by 10 so that the current would at least approximate the current accumulated over the same time interval. The table certainly has a telling tale to tell in comparing duty cycle ON time with inductance rise time.
Note that this table and chart do not take into account the switching frequency of the commutator or the dead band in between segments. Nor does it make an attempt to average current. It merely is comparing the max current that could be achieved during the 150 Hz ON time period due to motor winding resistance and inductance. Please note that the 100% duty cycle 150 Hz switching frequency does approximate the published 133 amp stall current of the CIM.
Although the 15kHz current does look linear, please note that the plot is merely in a linear region of the same type of curve do to the stretched time base of the horizontal axis. The values are real though. At 15kHz, the motor current cannot rise to near max values even at 100% duty cycle due to the L/R time constant vs input frequency.
Remember that series wiring resistance, controller Rdson resistance, battery voltage and many other variables will serve to change these values.

vamfun
18-05-2009, 13:59
Ok Al,
Its about time you dusted off the excel sheet. I feel that you are not yet comfortable with my explanation so we need a few more rounds. The peak current is instructive but is only valid for Vemf = 0 and tells just a small piece of the story. The reason you had to multiply by 10 for the JAG is because the JAG pulses must accumulate to get to the average current with the big L/R. Until you incorporate the discharge half of the cycle which includes the diode you cannot fully explain the nonlinearity, for it is here that the ratio of L/R to PWM period that makes the difference in the average current. Without the diode, this phenomenon would not occur.

EricVanWyk
18-05-2009, 14:21
Ok Al,
Its about time you dusted off the excel sheet. I feel that you are not yet comfortable with my explanation so we need a few more rounds. The peak current is instructive but is only valid for Vemf = 0 and tells just a small piece of the story. The reason you had to multiply by 10 for the JAG is because the JAG pulses must accumulate to get to the average current with the big L/R. Until you incorporate the discharge half of the cycle which includes the diode you cannot fully explain the nonlinearity, for it is here that the ratio of L/R to PWM period that makes the difference in the average current. Without the diode, this phenomenon would not occur.

I believe and agree with you, but I must reneg on our original contract - In order to get the beer, I now ask that you explain this in a way that my students could understand it.

Al Skierkiewicz
18-05-2009, 15:45
Chris,
Again I ask you to consider that the diodes only conduct IF the EMF exceeds the battery voltage which is rare or when the inductive kick attempts to raise the voltage. I multiplied the jag by 10 only to allow the two graphs to appear on the same scale. The average current for both controllers will be far less except at 100% duty cycle when average and peak are approx. equal. If the diodes do not conduct there is no EMF induced current. The graph simply shows the calculated current through the motor due to the effects of the pulse width (calculated at and for the length of the pulse due to the duty cycle). You cannot see the voltage developed across the inductor but a current probe or other method of looking at current would demonstrate this phenomena.

vamfun
18-05-2009, 15:52
I believe and agree with you, but I must reneg on our original contract - In order to get the beer, I now ask that you explain this in a way that my students could understand it.

Your are tough Erick... "come and enjoy your beers and I'll give you two more if you can make my kids understand it" would have kept me from dying of thrist while I work on the problem some more.

"I believe" bothers me.. "I understand" would make me feel that at least I have communicated enough for a mentor to understand. This is all I can do. The mentor must take it from there since the level of students varies between something and wiz kids. What I think is missing from this thread are a few time histories that show how the waveform is behaving and maybe I'll spend another day modifying my hbridge.vi to output a waveform as well.

I was able to explain this to my software kids with a white board in about 15 minutes...however, they have had a few prep lectures regarding motor nonlinearities and a little control theory.

vamfun
18-05-2009, 16:20
Chris,
Again I ask you to consider that the diodes only conduct IF the EMF exceeds the battery voltage which is rare or when the inductive kick attempts to raise the voltage.


I felt this is what was bothering you Al... and this point needs to be debated.

I don't see the battery voltage entering into it unless all FET's are OFF the return path is through a high side diode and a low side diode on the other side of the bridge. This return path is then through the 12 volt source and ground. But, the JAG leaves a lower FET in the ON state. This shorts one side of the motor to ground and only the diode on the remaining low side of the motor can complete the path to ground. This path is easily completed by reversing the voltage across the inductor.

V_L = -v_diode - i*R - Vemf . This inductor voltage remains until the current drops to zero and we reach the open loop state.

Al Skierkiewicz
18-05-2009, 19:33
Chris,
The equivalent loop is Vemf-Imotor*Rmotor+2.5volts >> Vbatt for the diode(s) to conduct. In terms of an equivalent, think of the EMF as a battery with the positive lead connected to the postive lead of the battery through the motor internal resistance, the diodes with cathode connected to the positive lead of the battery and the circuit resistance as a series circuit. Current will only flow when the EMF exceeds the voltage drop in all the resistance plus the forward diode drop of both diodes in the FET strings.
My contention is that this will only be the case if the inductor creates a spike and then for only a very short time. The path only exists for the period when the voltage is jumping the gap between segments on the commutator on the trailing edge of the commutator segment. This occurs because or the collapsing magnetic field of the winding just opened not because the controller has gone to zero output. Since there is no sync between the segments and the controller switching frequency, the inductive spike occurring during the off period of the controller is random and unpredictable. In fact even that repetition rate is variable with motor speed. So for your purposes, when the controller has gone to zero, the sum of the EMF and wiring voltage drop must exceed the battery voltage plus 2.5 volts for current to flow. Even if the lowside FET is still turned on, the junction will be shunted by the diode when it is forward biased. My belief is that the EMF won't exceed this unless the system is receiving external force to drive the motors faster than they were turning during the controlled "ON" period. I believe you can sample the EMF during this period but must account for those times when the diodes are forward biased and supplying current to the battery. Don't forget that the battery internal impedance is 11 mohms but the DC internal is lower. I think you will find that several samples over a defined time period will likely give you accurate results.

vamfun
18-05-2009, 21:00
the sum of the EMF and wiring voltage drop must exceed the battery voltage plus 2.5 volts for current to flow. Even if the lowside FET is still turned on, the junction will be shunted by the diode when it is forward biased.

For further discussions, I will always refer to Vemf as a battery or source and due only to the rotation of the motor. I refer to V_L as the inductor voltage that is caused only by the current rate in the wires.

I still don't agree with the quoted statement and its time we drew some pictures. I will post a few shortly...but I think its the current rate that you are neglecting. As soon as the 12v is switched off, the field created by the current collapses and creates a voltage drop across the inductor that tries to sustain that current. If the low side diode wasnt there it would indeed cause a spark and almost instanteous discharge of the coil. But, the low side diode is there to allow current to flow in the same direction but with a negative rate. So the inductor voltage jumps to the sum of :

V_L = -(i*R + Vemf + V_diode ) and the current now decays at a rate

di/dt = V_L / L until the current goes to zero.



The low side FET that is ON is still conducting current in the same direction as the charge period. (As far as I know, these MOSFETs can conduct current in both directions when turned ON but that is an unknown to me.)

Gdeaver
18-05-2009, 21:00
I don't Know if this affects the discussion, but I believe a high side FET is left on durring the PWM off period. They are applying the PWM to the gate driver enable pin. For forward the gate driver A PWM input pin is set high and the chip enable set to high. The B Gate driver PWM input pin is set low and the PWM pulse is applied to the B gate driver enable. So in the off period the A high side FET is in an on state and both B side FETS are off. So does this mean the inductive spike is clamped to the battery voltage or just above with the Fet resistance?

Al Skierkiewicz
18-05-2009, 23:52
Chris,
I believe we are talking the same thing. The collapsing field generates a voltage independent of the EMF of the motor. Whether caused by the FET switch or the brush assy, the pulse is very short but the path is still through the diodes and to the battery. The current flow induced is still subject to the diode forward bias and is clamped to Vbatt as Gary pointed out. If measured at the output terminal of the controller, the pulse would clamp at Vbatt+2.5 volts (the diodes forward drop). All that being said, the winding is still moving in a magnetic field and a voltage is induced in said winding but cannot exceed the supplied voltage unless an external mechanical source adds to the speed. Therefore, the EMF is not high enough to forward bias the diodes and will be something less than Vbatt when the controller is turned off. If the controller remains off, the EMF will wind down in proportion to the decreasing speed of the motor. This is fairly easy to see with a non loaded motor and a scope at the output of the controller.

vamfun
19-05-2009, 01:37
I don't Know if this affects the discussion, but I believe a high side FET is left on durring the PWM off period. They are applying the PWM to the gate driver enable pin. For forward the gate driver A PWM input pin is set high and the chip enable set to high. The B Gate driver PWM input pin is set low and the PWM pulse is applied to the B gate driver enable. So in the off period the A high side FET is in an on state and both B side FETS are off. So does this mean the inductive spike is clamped to the battery voltage or just above with the Fet resistance?

If I look at hbridge.c the way I intrepret the software switches is shown in the attached doc. When they say the minus side = LO then I thought the gates on the lo side were either on or off and the hi side minus gate was off. I could have these reversed. Look at this straw man and we will get full agreement on the configuration. I have only depicted the voltage input>0 drive state.

Update: the zip expands this to Chris config, Gdeaver config and an Al? config

s1900ahon
19-05-2009, 02:09
I don't Know if this affects the discussion, but I believe a high side FET is left on durring the PWM off period.

Uh, no. The low side MOSFET is turned on and the opposite high side MOSFET is turned on and off in proportion to the desired output. This is all done in hbridge.c. For example, the code to make M+ positive and M- GND is..

//
// Update the generator registers with the required drive pattern.
//
HWREG(PWM_BASE + M_MINUS_CTRL_GEN) = LO;
HWREG(PWM_BASE + M_MINUS_PWM_GEN) = ON;
HWREG(PWM_BASE + M_PLUS_CTRL_GEN) = HI;
HWREG(PWM_BASE + M_PLUS_PWM_GEN) = PULSE;


..where HWREG() is a macro that dereferences the unsigned long value pointed to by the BASE+OFFSET, in this case registers within the PWM unit. The defines ON, LO, HI, and PULSE are predefined values for the PWM's GeneratorA/B registers.

What the code above says is to set the control input of the M- gate driver to 0 and set the enable to be 1, making the output turn on the low side MOSFET of M-. The next two lines turn on the control input of the M+ gate driver, BUT to PWM the enable. This pulses the high side MOSFET of M+.

The reverse direction is similar, but reversed.

-Scott


It is important to remember that there are (unfortunately) two things referred to as PWM: the 3-wire hobby servo signal, and the functional unit in the MCU that controls the HBridge. For this note's purposes I strictly refer to the latter. The pulse-width modulating of the HBridge.

vamfun
19-05-2009, 18:21
It all hinges on the "off" PWM current. We have a low FET "on" and the rest "off". Any current flow must now pass through a protection diode. As long as the diode can conduct, the current is heading toward a steady state value of -Vemf/R (assuming positive current during the "on" PWM drive). If the L/R is short with respect to the PWM period, the current decays quickly and is zero for most of the off phase. So the average current for the whole pulse is determined by the area under the "on" pulse which = (12-Vemf)/R*duty. This would be the case for the slow Victors and we would expect a nonlinear response equal to my old coast formula.

For the JAG, the L/R is large relative to the PWM period. If the current cannot decay to zero during the "off" phase, it will continue to accumulate until the average current stabilizes. Since the current never gets below zero we can consider the problem as the superposition of a steady state Vemf and a pulsed 12v. And this leads us to the linear equation = (12*duty -Vemf)/R .

Here are the time histories I promised to support my argument. They were made assuming the high side switching model.

There are two plots for the .3 duty case: one for the 884 and one for the JAG.

These plots were made with the attached LABVIEW Hbridge time history vi and I think Eric will find it goes a long way to help explain whats going on. The sim allows you to follow each pulse as it accumulates ....but its like watching paint dry...so I added a "pre_init" that runs the sim to steady state current and then turns on the plots. I am by no means an accomplished LABVIEW programmer so I chose it as practice ... It would be great if some real programmers tidied it up. But , I'm real happy with how it works.

If Al doesn't at least try the program I'll be disappointed.

Have fun all and I welcome any comments to help improve the model.

PS if the configuration settles to something else, I can easily update the program.

Al Skierkiewicz
19-05-2009, 22:10
Chris,
Sorry, I don't use Labview and I don't have access to it at work or at home. The waveform for the Victor looks as I would guess with no discharge path but the Jaguar shows some discharge path with the obvious triangular waveform expected for a closed circuit. We know that the EMF does not approach battery voltage until the motor is at free speed so at 30% duty cycle even with no load, the EMF is much lower than the battery. I agree the diodes conduct during the immediate discharge voltage spike following turn off, but rapidly falls to EMF-motor resistance voltage drop, which is still much less than the battery voltage. Since the battery is on the cathode of the diode/FET string and the lower EMF is on the anode, the diodes do not conduct during much of the off period.
However, just to run a simple check calculation for current in the Victor during turn on, the motor current works out to over one hundred amps at 30% duty cycle. Even if I work in some numbers for the series resistance (battery internal resistance 11 mohm, Tdson of all FETs=5.3 mohm, motor resistance 90 mohm and allowing for 10 mohm of wiring losses that comes to 116 mohm) the motor current still works out to 95 amps at 30% for 120Hz and a little under 2 amps for the on period of the Jaguar at 15kHz with the same duty cycle.

vamfun
19-05-2009, 23:03
Al,
It is important that you respond to post 30 since we can never come to agreement until this diode issue is settled. I spent some time making these pictures as a means of clarification since words aren't doing it.

EricVanWyk
20-05-2009, 08:39
Nice App! I'll take you to Strange Brew - much better beer than Milly's.

In my mind, there were two possible reasons for all of this:
1) Longer periods widen the gap between mean current and rms current.
2) Longer periods force the inductor to "run dry". The "dry" period affects the effective duty cycle.

My interpretation of your app supports #2, but not #1.

I just ran the simulation at 1kHz. I think this frequency shows the problem most clearly. You can clearly see ramp up, ramp down, and dwell. As you dither around that frequency, the ratio between those three sections does not remain constant. This means that the effective duty cycle is chop-frequency dependent.

These results match perfectly with text-book buck regulator design principles. And really, what is an H-bridge other than a buck-boost regulator arguing with itself? I'm convinced that I could teach my students without any (ok, much :) ) hand waving. I still think it would be a great topic for a white paper.

For LabVIEW-less Al -
His code wraps the following in a code block. You can stick it into language-of-your-choice.

//Hbridge simulation... one side only
//Input duty cycle duty
//Output motor back emf v_emf
//Parameters

L=L/1000000. ;//convert uh to henrys
tau = L/R;
dt = T/100; // set 100 steps per pwm period
tau_motor =1/( kt*ke/R/Izz); // time constant of loaded motor
c_motor = ke*kt/Izz;

if(t==0) avg_current = 0;

// Begin integration of current and motor voltage

T_cycle = t - T_start;
// compute on cycle current
if(T_cycle <= T*duty)
{
v_drive = 12 ;
current_rate = (v_drive - v_emf - current*R)/L ;//ON phase current rate

}
else
{
v_drive = 0;
current_rate = (v_drive - v_emf - v_diode -current*R)/L;//OFF phase current rate

}

if(v_emf>0) { v_emf_rate =c_motor*(current - i_free);}
else
{ v_emf_rate = c_motor*(current+i_free); }

cum_current = cum_current + current*dt;

if(T_cycle>=T) { T_start = t;
avg_current = cum_current /T ;
cum_current = 0;}

current = current + current_rate*dt;
if(v_drive == 0 && current<0) current = 0;
v_emf = v_emf + v_emf_rate*dt;
t = t + dt;

if(pre_init == 1 && (abs(1-avg_current/i_free)<.005)) pre_init = 0; //Done with preinit
v_emf_norm = v_emf/12;

Al Skierkiewicz
20-05-2009, 08:47
Sorry guys, it was a long day in a seminar for wireless mic theory, frequency coordination and application...
I am including a slide at the end of your power point, attached. We should keep in mind that there are a few variables that we are using that are heretofore unpublished and untested. Namely motor inductance, motor resistance (which we backed into) and guesses as to series resistance of wiring feeding the controller. Segment length has not yet entered into the discussion for calculation purposes.

Gdeaver
20-05-2009, 08:54
Sorry, I was confused and wrong. I looked at the same stuff you guys did and yes the low side fet is on in the PWM off period. Maybe my brain saw what I expected to see. Most of the small motor controls I have switch the low side. I believe IFI switches the low side. The jag switches the high. What factors led the Jag developers to want to switch the high side? Where does the Spike flow? I'm confused more than ever after reading this post. Will you guys continue to beat this up and enlighten me?

Al Skierkiewicz
20-05-2009, 09:06
Gary,
It is my impression that the bootstrap capacitor is more easily charged with this configuration.

vamfun
20-05-2009, 14:38
Sorry, I don't use Labview and I don't have access to it at work or at home.
Rats...I presume your team software group has LABVIEW on their laptops. Have one of them download the app and give you a five minute lesson on how to alter the parameters on the dashboard. No LABVIEW experience needed. If you still can't do this...then wrap a while loop around my kernel that Eric posted in a C or vbasic or FORTRAN or whatever program you have and do the simulation yourself. Modify the differential equations to match your mental H bridge (I assume its different than mine) and see if you can duplicate what we see.

You remained silent with respect to my H bridge configuration and expanded on my "AL" model in the ppt revision so I assume it matches you model. I claim that this "AL" model is only valid for the coast configuration...which we have established is only in effect for "0" duty, coast enabled conditions.

Please tell me why my PWM off , single diode configuration is wrong or just accept it so we can proceed.

We know that the EMF does not approach battery voltage until the motor is at free speed so at 30% duty cycle even with no load, the EMF is much lower than the battery.
Not so for the 120hz victor.

I agree the diodes conduct during the immediate discharge voltage spike following turn off, but rapidly falls to EMF- The rapid fall off is not all that rapid relative to the pwm period for the JAG.

However, just to run a simple check calculation for current in the Victor during turn on, the motor current works out to over one hundred amps at 30% duty cycle. Even if I work in some numbers for the series resistance (battery internal resistance 11 mohm, Tdson of all FETs=5.3 mohm, motor resistance 90 mohm and allowing for 10 mohm of wiring losses that comes to 116 mohm) the motor current still works out to 95 amps at 30% for 120Hz and a little under 2 amps for the on period of the Jaguar at 15kHz with the same duty cycle.

You were heading in the right direction but got off a stop early.... The current is indeed high for the victor and the motor/Hbridge resolve the dilemma the only way they can...by raising Vemf to 10 volts. This lowers the currents to what you see in my picture and allows the average current to equal 2.7 amps. This is why the victor speed is so high at .3 duty. My simulation shows Vemf/12 = .84

vamfun
23-05-2009, 01:05
In response to Eric:
Nice App! I'll take you to Strange Brew - much better beer than Milly's.
Thanks... I've done a little rewrite to add the motor voltage so we can see what a scope on the motors might look like(see attached vi). You can see Vemf in the Victor motor voltage but it is absent from the JAG motor voltage as expected since during the JAG "pwm off" phase the diode is always conducting and so the diode voltage is all that you see.

Strange Brew is ok by me.... I'll fit right in.

You can clearly see ramp up, ramp down, and dwell. As you dither around that frequency, the ratio between those three sections does not remain constant. This means that the effective duty cycle is chop-frequency dependent.
I think you got it... however, I would rather just say that the average of these three sections is frequency dependent . Duty cycle implies to me a constant amplitude signal so you would have to map the input duty cycle to the new effective duty cycle as a function of frequency but then apply it to a system that was not frequency dependent such as a low pass filter without the diode. This would be another way of looking at it.


I still think it would be a great topic for a white paper.
When is your first draft coming out...

Al Skierkiewicz
23-05-2009, 17:44
Sorry to get back to this so late. Layoffs, salary reductions and elimination of 403b contributions take precedent.

Now I am the one that is confused. We started out looking at linearity and then progressed to start configuration and simulations. Now I am not sure where we are at. So let me answer a few things. Wildstang did not choose to use Labview, we did not load it or attempt to learn it. Our software team uses C everyday and that is the only thing they wish to use. If we are going to discuss operational differences at speed between the two controllers, then the discussion and simulation is useless without a valid calculation of CEMF (Counter EMF) and the introduction of switching for the commutator at that speed.
To remind our readers, CEMF is a variable based on the rotational speed of the motor, the number of magnetic poles, the number of windings on the armature and the subsequent switching by the brush assembly, and the load on the motor. Therefore, without establishing that the motor is turning at the same speed for each controller with the same data input, no comparison/calculation can be made as the CEMF and speed would be different. Additionally, the CEMF is not a pure DC voltage, but varies as the windings pass through the magnetic field. From memory, this could be as high as 2 volts peak to peak. The result is a pulsed DC that looks more like a full wave rectifier output. At least some of the time, the brush assembly is contacting two windings and the rest of the time it is contacting only one. The simulation must also account for that phenomena for inductance, resistance, CEMF and supply current.
As to differences between the "OFF" times on the two controllers and coast/brake. My understanding is the PWM output of both controllers varies between battery voltage and zero volts irrespective of the brake jumper as long as the controller has a valid speed signal present. This is accomplished by turning off one set of FETs, opening the circuit to the motor.
It is not possible for me to get into the shop in the near future, but I would like to parallel a PWM drive signal to a Jaguar and a Victor, one feeding each side of our test bed drive base. That can at least tell us if the resultant speeds are identical for various throttle positions under minimum load with a transmission attached. It will also allow me to measure the commutator frequency for different motor speeds, and to look at the CEMF of each motor with the two controllers.
As to the spreadsheet I first published, the data was calculated with the understanding we were still talking about start configuration. During start, CEMF would be non-existent as the motor is not yet turning. The data calculated would appear to be accurate for the two controllers, other than the slight error introduced by the multiplication of the Jaguar values by ten to coorelate with the same time period for the Victor's first "ON" pulse and using the resistance and inductance of two windings in parallel as the worst case model. The eventual Victor current that approximately equals the specified stall current validated that calculation namely 133 amps.

vamfun
23-05-2009, 19:35
Now I am the one that is confused. We started out looking at linearity and then progressed to start configuration and simulations.

Ok.. lets regroup.

My objective was to describe what causes the JAG to be linear.

I first conjectured that it was probably due to the commutator segment seeing more JAG pulses than the Victor.

The first excel I did tried to model the segment switching and showed that there was no difference between the Victor and JAG... but I goofed and assumed that the currents headed for zero rather than -Vemf/R in OFF phase. This was an important oversight and made all cases look like the victor.

In rethinking the problem, it became clear that the diode in the OFF phase was allowing the inductor to "run dry" (I think these were Eric's words) for the Victor but not for the JAG. This is because L/R is short with respect to the Victor period and the current decays and is zero for most of the OFF phase. The JAG on the other hand looks like a pure inductor because the frequency is so high (in an A/C ckt its impedance would dominate the R) and just integrates the voltage pulses . The current doesn't decay much in the OFF phase so the current builds up until the motor moves. Vemf comes into the picture and there is a transient but the current never goes negative and the diode is always conducting. This led to my two little equations:

i_free*R = (12-Vemf)*duty for the Victor (behaves like a diode in OFF phase and all current comes from ON phase duty cycle)
i_free*R = 12*duty -Vemf for the JAG. (behaves like a short in OFF phase
so current can remain in the inductor and we can model it as a simple linear low pass ckt with a chopped 12 v and DC Vemf)

These equations match the measured performance amazingly well!!!

My DOOH moment came when I assumed the Victor was running in a coast mode (with diodes) and the JAG was running in the brake mode (shorted)during the OFF phase since this seemed to match the results we were getting.

You reminded me that there is no difference between the coast and brake mode under normal operating conditions. So... rather than go back to the excel and try to model a complicated switching problem I just wrote a basic LR switching simulation to see how it would match the results of the simple equations. The first LABVIEW program showed speed vs duty for Victor 120hz,2k hz and JAG 15k hz. The plots looked realistic and I was happy(http://www.chiefdelphi.com/forums/attachment.php?attachmentid=7949&d=1242511867) To make these plots, I ran the time simulation to steady state. I had to fool with L but the final value was within reason with old CD posts.

Eric wanted more explanation so I modified the program to output the waveform time history and it really helps others visualize what's going on. It hasn't helped you since my LABVIEW choice wasn't good for your team. I could have done it five times faster in C or MATLAB!!

It is important to note that my model has only one diode in the OFF phase and it returns current in a ground loop involving the motor and the diode.

Enter Al... seemed almost all your comments involved two diodes and a 12 v return path for the current and it would never jive with what I was showing. Of course you educated us on many other things along the way as well. But this was the biggest issue in my eyes.


To clarify the circuit, I generated some flow graphs in the ppt showing my high side switching model with the one diode return loop plus an "Al" model that had two diodes and 12 v current return path hoping to nail this down. You responded by elaborating on the "AL" configuration and said nothing on the single diode return so I assumed that this was your Hbridge return model.

We have yet to agree on this unless I'm missing something:)

I am not naive enough to believe that you can simulate any real Hbridge without taking into account all the effects you mention. But, it is my assertion that all these effects are secondary to the problem of linearity and the simple LR switching model does a good job in explaining the phenomenon and thats all you can ask of a model.

This is why I encouraged you to do the simulation. My simulation code is basically written in C and wrapped in a LABVIEW while loop(see spoiler in http://www.chiefdelphi.com/forums/showpost.php?p=860519&postcount=35.) I was hoping you would examine the differential equations , which include inertia dynamics and coulomb friction effects and run something similar in C , however, you'll have to substitute for the nice LABVIEW graphics. We would all like to see some real lab data in addition to the Beach Bot data I posted which showed the simplified model matching to within 5% by adjusting i_free to match installation friction. Hopefully, things will settle down in your work and give you some time to tinker and that this post didn't confuse things further.

Post note: I was never really concerned about the start transient. All my simplified equations address the steady state. After I posted my LABVIEW plots showing how well the steady state simple LR model worked, you posted your start up excel transient. This was perfectly accurate but the plots seemed sooo misleading because there was a linear one for the JAG and a nonlinear one for the Victor. Although you did not claim that that was the reason for the phenomenon...it just looked like it was key. So I jumped on it and pointed out that the main reason for the phenomenon was the difference in the OFF phase currents which were not represented there.

Al Skierkiewicz
24-05-2009, 19:25
Chris,
I think we keep missing each other here. So lets agree on some things assuming for the moment that the brush/commutator is not switching and we are trying to analyze one simple winding...

Vemf=Counter EMF=CEMF, which will be the same for either controller in the "off" condition or in coast, when connected to the same type motor running at the same speed.
CEMF will be less than Vbattery unless additional mechanical force is applied to the system or will be zero if the motor is not turning.
If we identify the four parts of the H bridge such that the two FET groups connected to positive battery terminal are labeled A & B, and the two FET groups connected to negative terminal are labeled C & D. Then for one motor direction group A & D are turned on and for the other motor direction B & C are turned on.
All FETs in both controllers have diodes from source to drain as part of their implementation/manufacture.
When any (or all) FET group in either controller is turned off, the motor inductance will make a voltage spike whose polarity is opposite of the applied voltage during the "on" phase of the PWM output and in the same polarity as CEMF.
The drop across the Victor diodes is 1.2 volts and the Jaguar is 1.25 volts.

If these conditions exist then two sets of diodes will conduct the voltage spike through the series circuit that includes the battery and all wiring to that branch. The current will continue to flow only until the voltage spike plus CEMF exceed the battery voltage and the voltage drops across the resistance of the wiring and the forward drop of the diodes.
If motor current is supplied by FET groups A & D then the diodes in B & C will conduct during the discharge.

vamfun
24-05-2009, 22:36
Chris,
Vemf=Counter EMF=CEMF, which will be the same for either controller in the "off" condition or in coast, when connected to the same type motor running at the same speed.
CEMF will be less than Vbattery unless additional mechanical force is applied to the system or will be zero if the motor is not turning.
If we identify the four parts of the H bridge such that the two FET groups connected to positive battery terminal are labeled A & B, and the two FET groups connected to negative terminal are labeled C & D. Then for one motor direction group A & D are turned on and for the other motor direction B & C are turned on.
All FETs in both controllers have diodes from source to drain as part of their implementation/manufacture.
When any (or all) FET group in either controller is turned off, the motor inductance will make a voltage spike whose polarity is opposite of the applied voltage during the "on" phase of the PWM output and in the same polarity as CEMF.
The drop across the Victor diodes is 1.2 volts and the Jaguar is 1.25 volts.


OK so far so good.
If these conditions exist then two sets of diodes will conduct the voltage spike through the series circuit that includes the battery and all wiring to that branch. The current will continue to flow only until the voltage spike plus CEMF exceed the battery voltage and the voltage drops across the resistance of the wiring and the forward drop of the diodes.
If motor current is supplied by FET groups A & D then the diodes in B & C will conduct during the discharge

Here is where you lose me. If the motor current is being driven by A & D when A turns off D is still left "on" in the JAG. This provides a near short to ground on the C & D side of the motor and as I see it the spike can only flow through B diode and a short to ground . So only one diode and an "on" D FET in series with the motor need be considered in the circuit.

Signed Confused

Gdeaver
25-05-2009, 12:19
Chris,
You started this analysis looking to see if the Jags perceived linearity is a result of switching frequency alone. The discussion has evolved and now focused on what happens at the turn off. It's now apparent that there is a second major difference between the 3 controllers. The IFI 883 and 884 are low side switchers with a frequency of 120 and 2000. The jag is a high side switcher with a frequency of 15000. Al has pointed out that there is allot more going on because the h-bridge involves rotating magnetic fields and brush switching. So they have been ignored. Now, I can see your transient and current path at shut off. The low side D FET being on is the key since it is a low Resistance path. I Don't see where current would flow thru AL's path unless the transient is massive. Now I'm a little confused on the victor path.
The high side A Fet Is left on and the D Fet Turned off. The A-C side is left at vbat - the FET resistance. Where does the current flow? What happens on the B-D side. Seems to me the transient and back EMF would be clamped very fast By the high side on A fet. Do I have it right? So if I have this right
The IFI low side switcher decays fast and the jag high side switcher decays slower. Make sense? Now with the Jag the C FET diode bears the brunt of the off period current decay and with the IFI the A FET Bears the load but since it is on there is less stress. Make sense? Could this be a source of the jag failures? The Fet in the jag is not particularly designed for repetitive avalanche compared to some other fets. ( off topic but curious)
On the subject of controller linearity, IFI stated when they introduced the victor 884 that it gave better control in low duty cycle condition for controlling things like an arm where the motor maybe required to maintain a holding current. Now add in AL comments that there is allot more going on with the controller and motor than the simplified model in this discussion. Under real conditions, does the Jag maintain its linearity at low duty cycle conditions? Does the Jag trade controllability at high duty cycle rates and sacrifice the low end? Did IFI sacrifice the high for better control at the low end ? Al mentioned the word deterministic. These models can get nasty and complex real fast when all the variables are added in. At some point some real data will be needed to confirm this.

Joe Ross
25-05-2009, 12:27
On the subject of controller linearity, IFI stated when they introduced the victor 884 that it gave better control in low duty cycle condition for controlling things like an arm where the motor maybe required to maintain a holding current.

I beleive that when IFI talked about the low duty cycle control they were talking mainly about the minimum duty cycle. The minimum duty cycle of the Victor 883 was 10%, while the minimum duty cycle of the Victor 884 is 3%.

Here is a visual indication of how the jaguar and victor 884 do with their minimum duty cycles: http://forums.usfirst.org/showpost.php?p=20908&postcount=4

Al Skierkiewicz
25-05-2009, 14:05
OK,
I think I am seeing this your way now. The low side FET D is always "on" according to Scott so that when the PWM goes low, the high side FET A opens. Current developed by the decaying inductance now flows through the FET D across the common (negative terminal) and forward biases the diode in FET C. I think then, that the expectation is that neither diodes at A or B would conduct although conditions might allow that to happen for a short period of time. Does the discharge path then have significantly less resistance than the charging path and would that need to be compensated for in the calculations? That is until the discharge falls to CEMF less the voltage drop across the diode and FET on resistance.

Gdeaver
25-05-2009, 15:11
Thank you Mr. Ross,
Yes, that is a real world confirmation of the jags linearity and controlability. Now back to Chris and AL. Is the PWM frequency the main factor between the 2 controllers or is the switching method also a factor? Why did IFI drop the frequency if there are so many benifits to a higher fequency? Did Luminary MIcros give us linearity and controlability but also introduce added stress that may have caused a number of failures that accurred?

vamfun
25-05-2009, 17:28
OK,
I think I am seeing this your way now.

You were a tough fish to reel in, but welcome aboard.


Does the discharge path then have significantly less resistance than the charging path and would that need to be compensated for in the calculations?

good question.. my models have not assumed any difference in R for charge and discharge. We know this is a simplification since in addition to the motor resistance the charge path includes the full system installation losses (battery, power panel, wires etc) and the discharge only includes some motor wires and some internal JAG losses. These could be estimated and one would expect the discharge time constant to be longer than the charge time constant (maybe 30% to 40% higher). I suspect this would make the Victor look a little more linear. If you post some typical numbers, I could add these effects in easily. How about updating your ppt slide to show all the losses and your estimate of what they might be. This can be added to the new ppt I just posted.

vamfun
25-05-2009, 17:40
Is the PWM frequency the main factor between the 2 controllers or is the switching method also a factor?

Ok..now that Al is onboard I updated the ppt to represent the JAG / Victor and added the Brake/Coast configurations and the ABCD notation. See JAG/Victor Hbridge.5.25.ppt zip attach. We can all contribute to this as a document and capture stuff as we go.

If you compare the high side and low side OFF circuits there is no difference in how one would model them. There is still only one diode in the return path around the motor. The charge paths are identical. So I would say the switching method is not a factor.


EDIT: There was typo in Brake mode title. Should be "JAG BRAKE CONFIGURATION C and D FET's ON". Fixed and reposted rev1 file.

Al Skierkiewicz
26-05-2009, 08:56
Whoa, not on board yet, just in the same lake.
In your power point, the FET groups B and C are turned on for direction control. The CEMF is the opposite polarity of that so current is reversed from what is drawn when in the "brake" mode. The effect should be the same for either controller, just a difference in which FET groups are in effect. In thinking the brake mode through, at least initially, the CEMF of the motor could be high enough to force enough current through the path to actually turn on one of the diodes.
At this point, the Rdson of the FET groups should be brought into the discussion. The Jaguar uses a FET with lower Rdson and is equivalent of 1.8 mohms per group. The Victor is 4 mohm per group. However, the specs are tested under different conditions and I suspect that they are somewhat closer than you would expect. The Victor is speced for pulse widths less than 400 micro seconds @<2% duty cycle, while the Jaguar FET is a little less obvious as to minimum pulse width and duty cycle.
As to series resistance in the initial run phase (charge the inductance), typical wiring techniques would give you the same series resistance up to the controllers and from controller to motor. I usually look at worst case analysis so 11 mohm for the battery, 4 mohm for connectors, breakers, terminals, etc., and 6 mohm for wire using #10. Add in the 0.5 mohm current sense resistor for the Jaguar as well. So for Victor total series resistance could be as high as 29 mohms and for the Jaguar and 25.5 mohms for the Jag.
Those are small differences so the only thing left is the actually switching frequency, which we both have proved results in lower the current for the Jag compared to the Victor due to the L/R factor and charge current of the motor inductance. Realistically, the lower current, would translate to lower speed and therefor, lower CEMF for the Jag. We need to get true duty cycle vs speed data for each controller to the same motor. I have no availability in the near future for experiment. Analog TV shutdown is on the horizon and several weeks of transmitter duty are in my future.

vamfun
26-05-2009, 15:13
Whoa, not on board yet, just in the same lake.
Ha..just meant that the OFF return now has one diode..I know you aren't on board with anything else yet.

In your power point, the FET groups B and C are turned on for direction control. The CEMF is the opposite polarity of that so current is reversed from what is drawn when in the "brake" mode.
There is a typo in the title: Should be "JAG BRAKE CONFIGURATION B and D FET's ON". Otherwise the slide is ok.

In thinking the brake mode through, at least initially, the CEMF of the motor could be high enough to force enough current through the path to actually turn on one of the diodes.
I don't see how since both ends of the motor are shorted thru B and D "on" FETs.

As to series resistance in the initial run phase (charge the inductance), typical wiring techniques would give you the same series resistance up to the controllers and from controller to motor. I usually look at worst case analysis so 11 mohm for the battery, 4 mohm for connectors, breakers, terminals, etc., and 6 mohm for wire using #10. Add in the 0.5 mohm current sense resistor for the Jaguar as well. So for Victor total series resistance could be as high as 29 mohms and for the Jaguar and 25.5 mohms for the Jag.

Your calculations agree with the 30mhoms I assumed in rerunning the sim with different R_on and R_off. R_on and R_off are the total effective resistances during the PWM ON and OFF phases. I checked the speed changes with R_on = .12 ohms and R_off = .09 (basically just the motor resistance). I saw essentially no differences for the Victor and slight differences for the JAG vs running the cases with R_on=R_off = .12 ohms. So this is a secondary effect.

We need to get true duty cycle vs speed data for each controller to the same motor.

We have two data sets to work with. The Beach Bots provided us with 884 CIM 01 responses and we have several JAG linearity plots posted which were supposedly for a CIM. The motor variations and installations would be slightly different but at least we have some data. Hmmmm, if we could only get Joe Ross to run some more data comparing the two.

Al Skierkiewicz
26-05-2009, 16:33
Chris,
I am thinking out loud that a motor in a drive on a 150lb FRC robot might be able to produce significant current in "brake" mode that might just bias one of the diodes for a period of time.
I am looking at your slide 9 and the CEMF would cause a current to flow opposite of the direction shown in slide 12. No real effect on result.
Can you link to a Jaguar table showing the same duty cycle and motor speed for a CIM as documented in the Beach Bot data?

vamfun
27-05-2009, 00:49
Ok..EDIT: There was typo in Brake mode title. Should be "JAG BRAKE CONFIGURATION C and D FET's ON". Fixed and reposted rev1 file.

Sorry guys...going a bit mental.

Should be "JAG BRAKE CONFIGURATION B and D FET's ON". The fix is ok in rev1.

I am thinking out loud that a motor in a drive on a 150lb FRC robot might be able to produce significant current in "brake" mode that might just bias one of the diodes for a period of time.
I am looking at your slide 9 and the CEMF would cause a current to flow opposite of the direction shown in slide 12.

AL; re slide 9 and 12 . I don't understand what you are saying here. As I see it, there is no relationship between slide 9 and 12. Slide 12 "brake mode" stands alone. The current will flow in either direction and is dictated by Vemf sign. I have shown it for only one direction of course. Because B and D FET's are on I don't see how there can be any diodes in the picture.

Can you link to a Jaguar table showing the same duty cycle and motor speed for a CIM as documented in the Beach Bot data
I couldn't find the links...I saw one recently but don't remember where.
However, I did find a JAG curve that I think I downloaded from the FRC 2009 beta site. There was some discussion there and this was my first look at a JAG response. It also had a nice Victor curve. See attached .xls

Al Skierkiewicz
27-05-2009, 08:19
Chris,
Slide 9 shows current flow for the motor spinning in one direction. If slide 12 is showing the current flow due to CEMF for a motor running in the same direction in brake mode, then it should have the current flow in slide 12 reversed.

The attachment sheet tells the tale doesn't it? If a team was designing for the CIM motor to be in the more efficient part of it's curve or around max power, then the area between 3000 & 4000 RPM is the place to look. These curves are as we expected and do represent what is likely the interaction of the motor inductance, switching frequency and CEMF. The Jaguar is no doubt more linear in the region of interest but both controllers are linear in the area above max power and through the area of greatest efficiency above 4000 RPM.

Does the Luminary Micro title on page 2 indicate this came from Luminary?

Joe Ross
27-05-2009, 10:03
Does the Luminary Micro title on page 2 indicate this came from Luminary?

Yes. Here's the full thread on the FIRST forums: http://forums.usfirst.org/showthread.php?t=10182

vamfun
27-05-2009, 14:54
Chris,
Slide 9 shows current flow for the motor spinning in one direction. If slide 12 is showing the current flow due to CEMF for a motor running in the same direction in brake mode, then it should have the current flow in slide 12 reversed.

I see what is bothering you. I really didn't intend slide 12 to be sequential to any of the previous slides. But if it was ..the current in slide 12 must match the current in slide 9 or any other prior slide at initial switch over. The voltage across L will force this since the current cannot change instaneously. The current will eventually change sign and head for Vemf/R which is what you are looking for.

Thanks Joe for finding that link.. I knew I'd seen it recently.

vamfun
27-05-2009, 15:37
I woke up thinking about your excel http://www.chiefdelphi.com/forums/showpost.php?p=860049&postcount=20
and how you have implied (subtly) that this supports the case for lower JAG currents and hence lower Vemf. I cannot support this implication because it is involves comparing apples to oranges. The excel results simply state that if you run a 12 v pulse into an LR ckt you will drive less current if the pulse is 100 times shorter.

One must run both cases for the same time to compare. Let us pick the Victor period as the comparison time. At 100% duty cycle both the JAG and Victor will drive to the same current in that time period. You know this.

At anything less than 100% duty, you must now look at what happens during the off phase of the cycle to draw any conclusions re the average current over the period. The average current is the only thing that enters into the duty vs speed graphs we are looking at. In fact, you must look at the steady state average current that allows Vemf to drift into the picture as the current pulses are accumulated. The steady state criteria has not been defined yet by either of us but we would like it to be at least 5 time constants of a loaded motor.

So my good friend, the captain should not let you in the boat based upon this evidence. You must stay in the lake until you provide the analytical justification for extending your excel to steady state or do the brute force pulse accumulation with a simulation. Or accept the rationale and sim results I have put forth (I pray you will). Or just remain a wet skeptic ... that is fine also. I suspect you will favor the last option:)

Note: I have conviently defined "boat" as holding only passengers who have tried to explain the steady state. This way I can stay dry and have some beers on the poop deck. Others are welcome if they understand and accept anyones explaination. Skeptics are allowed but only as guests so we can still have a beer together.

I like you as a skeptic lurking in the water as a shark (a kind and gentle shark) waiting to feed on weak theories trying to get on board. It makes us all stronger.

Al Skierkiewicz
30-05-2009, 18:25
Chris,
The spreadsheet from Luminary supports lower currents and therefore lower speeds at less than full throttle for the Jaguar as expected. If the motor is turning slower, the EMF will be lower as well. The two graphs show that motor speed for both controllers approach specified free speed for the CIM at max PWM input. Luminary has also done the work I was hoping to be able to perform at some future date. They compared their controller with a resistive load and an inductive load (the CIM motor) although I question the resistive load "output voltage" and how it was measured. A simple RC filter would give that result. I would like to see the two compared for identical input PWM to make the graphs perfect but it is easy to see the differences. In either case, a mechanical solution and/or a software solution would be able to make either controller perform similar. A final note, we need to remind our readers that the Jaguar never reaches 100% duty cycle as it needs the pulse to keep the bootstrap capacitor charged. Without it the output FETs would not be turned on. This does not play into our discussion except at full throttle.
As a midwesterner and therefore confined to freshwater, the shark analogy is a stretch for me. Let's just say I am the unknown in the dark and muddy waters under the boat.
Chris, no need to edit. I received your request as a moderator.

vamfun
30-05-2009, 20:53
Al,
I'm glad you are still lurking in this thread. I didn't want it to end on my last quirky post.

Anyway, I was thinking that the Victor 120hz could be made linear by simply changing the switching sequence. If the normal charge phase had A and D fets on, then the off phase as it stands now would just be D on. What if instead they went to the brake mode in the off phase by also turning on B fet. This would eliminate the diode return and the circuit would then behave linearly just like the JAG. I suppose the reason they don't do that is for fear that both A and B fets might be on during the switching transient and cause a high current near short in the AB fet path. It seems that one could delay the turn on of the B fet (say 10 usec or whatever is necessary). Then most of the current could be captured in the off phase and keep the inductor from running dry. Any thoughts on this.

Post note:
I think I answered my own question: The resistive power loss would be much higher in the Victor without the diode. The current would drive to -Vemf/R on each off cycle so there is a large power loss during this phase now. I modified the LABVIEW sim to calculate avg_pwr just to check:
duty = .3 JAG pwr =. 737 watts with and with out diode
duty = .3 Vic pwr = 3.2 watts with diode and a whopping 121 watts without diode.


So for the trial switching of the Victor without the diode the power loss is ridiculous but the transfer function would be linear.

The data shows that for the normal case the resistive loss of the Jag is less than the Victor.
If the power loss of the diode is included, the Jag total power loss would be closer to the Victor since the diode is conducting during the PWM off time. The diode loss adds about 2.7v*1.2amps*(1-duty)=2.3 watts extra or 3.04 watts total.

Gdeaver
31-05-2009, 22:53
On the subject of H bridge controllers, it might be beneficial to look at this data sheet. It's for an Allegro automotive H bridge driver chip. In the data sheet it gives all methods of driving the external FET's, but stops short of explaining the advantages for the different methods.
http://www.allegromicro.com/en/Products/Part_Numbers/3941/3941.pdf
It's similar to the Referenced power point but goes further.Starting on page 13 all the drive methods that have been mentioned are shown and the last method where both lower Fets are turned on. It's referred to as slow decay as compared to fast decay with the diode in the recirculating loop. Slow decay adds the complexity of high side turn off and low side turn on. The Fairchild driver has shoot through protection but will not work in this design because the chip enable is being used for PWM control.
It was mentioned in this thread that the model was just like a DC -DC switching power supply with the 2 half brides stuck together. If you look at the data sheets for the jag Fairchid half bridge driver and the FETs, it also looks like the Luminar Micro designers had this view also. They chose a driver that was designed for a switching power supply. The FETS were chosen for low gate charge, fast on off and logic level for even easier drive. Perfect for a DC switcher because the half bridge is constantly switching Hi low hi low. The low side body diode only see's current for a very short time during the dead time while the low side fet is turning on. A DC switcher also has a large capacitance compared to the inductor in the circuit. For a motor the capacitance compared to the motor inductance is so small that it is essentially ignored. After following this thread I'm starting to see the differences between a half bridge switcher and a h-bridge motor driver.
What sticks out to me is that the thread has come to focus on the switch off and recirculation. In particular the low side body diode. In the victor how many times a second does the high side body diode see an avalanche condition? With the jag how many times per second does the low side body diode see an avalanche condition? How much power do they dissipate. Then, I know this model has been simplified and it's looking at averages, but what about the switch off transient? How big is it? Does it affect other parts? How much power is being dissipated by the diode in the recirculation?

After following this thread I have a hunch that historically this is what happened. IFI had the 883 design and it was fine in the beginning. With a frequency of 2000 and smaller drive motors, the non-linearity and power dissipation were not an issue. Then things started to change. First was going in the Tim Allen "More Power" direction. IFI saw the large drill motors and CIM motors in the future. They could see issues with the 883 design. They were faced with having to invest in a total redesign to handle the future needs. Instead of total redesigning the controller, somebody had the great idea of " hey lets just slow the 883 down and call it the 884". At the lower PWM frequency the same design could handle the CIMS except that irritating non-linearity issue that is the focus of this thread. Then comes Luminary Micros and the powerful micro controller. They jump in and give us a fantastic controller with a whole bunch of capability that will carry FIRST forward for years to come. Plus they gave us a linear controller. However the switching transience and power dissipation issues that IFI side stepped are back. Now Luminary Micros this year has proven by actions to be a primo grade A FIRST supplier. IF I'm right the jag needs a little redesign for 2010. Can LM address what IFI side stepped?

I know I went off topic and made some subjective statements, But this thread caused them. I'm not wearing the ceramic protective so please keep the temp down. Ok here I go I'm hitting the submit button.

vamfun
01-06-2009, 17:32
Perfect for a DC switcher because the half bridge is constantly switching Hi low hi low. The low side body diode only see's current for a very short time during the dead time while the low side fet is turning on.

Some of the wave forms on the scope lead me to believe this but the Hbridge.c tells us that only one low side fet is on under normal operating conditions. If charging with A/D on then the off has only D on when A is switched off. The B (low side) is not switched on. So no dead time is necessary.

A DC switcher also has a large capacitance compared to the inductor in the circuit. For a motor the capacitance compared to the motor inductance is so small that it is essentially ignored. After following this thread I'm starting to see the differences between a half bridge switcher and a h-bridge motor driver.

I have been thinking about this analogy for a few weeks now and I think it is an exact one. You can replace Vemf in the circuit with a large capacitor C = Izz/ke/kt (apporx 0.7 farads). Izz is the motor inertia load, ke and kt are the standard motor constants. This C relates the dVemf/dt to the difference between the inductor ( L ) current less a load current .

In a dc switching model the load is generally a resistor which draws a load current of Vout/Rload. In the motor model, the load current is nonlinear due to coulomb friction but there is probably also some proportional load due to viscous friction. The viscous current would be modeled with just a Rload across C.

So if you draw the circuit, it looks exactly like a DC switching supply except it does't have the regulator feedback. When the encoder speed or Vemf is fed back in an error loop then we have a complete DC switching regulator.

I view the motor as a series RLC with a diode across it and a load current source bleeding off the current from the L. The load current source would = - i_free*sign(Vemf). The RLC behaves as a RC circuit for low frequencies with first order time constant tau = RC . For high frequencies, we have the RL approximation, since the C looks like a battery with voltage Vemf and we have the switching current model. My simulation of course captures both these aspects in one model since I include the motor torque equation and inertia effects.

If you have access to a spice simulator, you can generate the transients equivalent to my sim. I had a little trouble with CircuitMaker because it kept coming up with a sim step too small error but a professional spice sim would probably handle it. If anyone wants to try it, I'll work with them to get the model parameters set.



With the jag how many times per second does the low side body diode see an avalanche condition? How much power do they dissipate. Then, I know this model has been simplified and it's looking at averages, but what about the switch off transient? How big is it? Does it affect other parts? How much power is being dissipated by the diode in the recirculation?

I could be dead wrong, but I don't see yet why the diodes need to operate in an avalanche condition. In the JAG normal mode, they would conduct during the off phase in a normal manner and the power would be similar to what I spoke of in my last post. You can make a good guess by assuming the current to be the average current running through 1.25v and multiplied by 1-duty. When the motor is loaded, the currents are very high but the 1-duty would scale the power dissipation.

Lets say we are in stall so Vemf = 0. The avg current is approx = 12v/R*duty. The power = 1.25*12/.1*duty*(1-duty)
= 150*(duty-duty*duty). The peak power would be at duty=.5 -> 150/4 or about 40 watts. So things things could heat up in a hurry if my thought process is correct. Of course we could guess...just look at the ratings of the FET diodes and the capability of the JAG design to dissipate heat. This I haven't done.

vamfun
03-06-2009, 18:39
I have been thinking about this analogy for a few weeks now and I think it is an exact one. You can replace Vemf in the circuit with a large capacitor C = Izz/ke/kt (apporx 0.7 farads). Izz is the motor inertia load, ke and kt are the standard motor constants. This C relates the dVemf/dt to the difference between the inductor ( L ) current less a load current .

In a dc switching model the load is generally a resistor which draws a load current of Vout/Rload. In the motor model, the load current is nonlinear due to coulomb friction but there is probably also some proportional load due to viscous friction. The viscous current would be modeled with just a Rload across C.

So if you draw the circuit, it looks exactly like a DC switching supply except it does't have the regulator feedback. When the encoder speed or Vemf is fed back in an error loop then we have a complete DC switching regulator.

I view the motor as a series RLC with a diode across it and a load current source bleeding off the current from the L. The load current source would = - i_free*sign(Vemf). The RLC behaves as a RC circuit for low frequencies with first order time constant tau = RC . For high frequencies, we have the RL approximation, since the C looks like a battery with voltage Vemf and we have the switching current model. My simulation of course captures both these aspects in one model since I include the motor torque equation and inertia effects.


Well I got CircuitMaker to work finally. I just picked a JFET that would do something. The actual spice models for the JAG would be closer. The Cm capacitance =7.5 farads for the assumed inertia load. I had used .75 to speed the motor response up in earlier studies.

I attached a Jpeg picture of ckt and a CircuitMaker model as a .C file. If you have CircuitMaker, download file and change .c to .ckt to run.

So..Maybe you ckt guys can whip up a better model of the FET's and try your luck with a spice simulator program.

Al Skierkiewicz
04-06-2009, 17:35
Chris,
I am woefully low on time but I did want to add the the diodes in the FETs are avalanche diodes by design.

vamfun
04-06-2009, 19:38
Chris,
I am woefully low on time but I did want to add the the diodes in the FETs are avalanche diodes by design.

Yes, I'm with you there re the high frequency avalanche conditions existing due to parasitic inductances. Models can get real complicated with parallel FETs and I leave this area to the experts.

I assumed that Gdeaver was referring to low frequency recirculation currents of the main inductance not the parasitic inductances. So I hope my comments were accurate in that regard.

Al Skierkiewicz
04-06-2009, 22:34
Chris,
I thought Gary was referring to the same thing as me. The FET data sheet lists the diodes as avalanche devices.

vamfun
05-06-2009, 13:13
Chris,
I thought Gary was referring to the same thing as me. The FET data sheet lists the diodes as avalanche devices.

I've seen the data sheets and fully agree that the diodes are avalanche devices. They will breakdown at 30 v.

I am maintaining that the avalanche condition will only be caused by the parasitic inductances since that is their only current path. These recirculation's are characterized by the higher frequency type waveforms (dying out in less than 10usec). The lower frequency (pwm period) currents associated with the motor inductance will not cause a reverse breakdown since these currents have a lower voltage path of a fwd biased diode in the base FET.