Go to Post Your team has a cave?!?!? OMG, how did you guys get that?!?! Do you have a cave sponsor? We tried talking to cave sponsors but none of them responded. You guys must be an elite team to have a cave. - marshall [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-05-2009, 20:09
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Failed attempt to explain JAG linearity

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.
Attached Files
File Type: xls Motor commutator effects.xls (97.0 KB, 122 views)

Last edited by vamfun : 10-05-2009 at 17:33.
  #2   Spotlight this post!  
Unread 11-05-2009, 04:26
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Failed attempt to explain JAG linearity

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%
Attached Files
File Type: xls Inductive motor model data fit.xls (100.0 KB, 103 views)

Last edited by vamfun : 11-05-2009 at 04:39.
  #3   Spotlight this post!  
Unread 11-05-2009, 09:51
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Failed attempt to explain JAG linearity

Quote:
Originally Posted by vamfun View Post
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.
  #4   Spotlight this post!  
Unread 11-05-2009, 15:45
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Failed attempt to explain JAG linearity

Quote:
Originally Posted by Joe Ross View Post
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.

Last edited by vamfun : 11-05-2009 at 16:04.
  #5   Spotlight this post!  
Unread 12-05-2009, 07:45
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,770
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Failed attempt to explain JAG linearity

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.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.

Last edited by Al Skierkiewicz : 12-05-2009 at 07:56.
  #6   Spotlight this post!  
Unread 13-05-2009, 08:07
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,363
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Failed attempt to explain JAG linearity

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.
  #7   Spotlight this post!  
Unread 13-05-2009, 15:35
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Failed attempt to explain JAG linearity

Timeout... I found a bad assumption in the excel that changes the speed curves but not the normalized current. Stay tuned.
  #8   Spotlight this post!  
Unread 14-05-2009, 15:58
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Failed attempt to explain JAG linearity

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?!

Last edited by vamfun : 15-05-2009 at 03:08. Reason: added some clarification
  #9   Spotlight this post!  
Unread 14-05-2009, 17:36
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Failed attempt to explain JAG linearity

Quote:
Originally Posted by vamfun View Post
Doesn't someone owe me a beer!
Next time you are in Manchester NH, I will get you TWO beers.
  #10   Spotlight this post!  
Unread 14-05-2009, 21:24
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,770
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Failed attempt to explain JAG linearity

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.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
  #11   Spotlight this post!  
Unread 14-05-2009, 22:14
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Failed attempt to explain JAG linearity

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.

Quote:
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.

Last edited by vamfun : 14-05-2009 at 23:19.
  #12   Spotlight this post!  
Unread 15-05-2009, 07:24
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,770
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Failed attempt to explain JAG linearity

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.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2009 Camera and Jag inventor models problem Creator Mat CAD 5 08-03-2009 14:05
1 Jag and 1 Victor not responding correctly. elbuo NI LabVIEW 4 17-02-2009 22:57
Joystick Linearity NinJA999 Control System 4 28-01-2007 18:49
pic: Yet another attempt at Photoshop Cody Carey Extra Discussion 1 08-04-2006 23:13
pic: Failed attempt at simulation CD47-Bot Extra Discussion 5 17-06-2004 11:03


All times are GMT -5. The time now is 16:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi