Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Motors (http://www.chiefdelphi.com/forums/forumdisplay.php?f=52)
-   -   Modeling motor control (http://www.chiefdelphi.com/forums/showthread.php?t=88193)

kamocat 02-01-2011 17:47

Modeling motor control
 
I'm trying to calculate the torque of a motor based on the voltage, speed, and current.
I'm actually interested in the torque at the output of the transmission, not simply at the output of the motor.
This means I need to know the no-load current of the motor.
I was thinking no-load current was proportional to voltage. Apparently it's not.

Here's a graph:


This is measured with a Jaguar over CAN, though I've confirmed the approximate current trend with a Fluke 179. (I didn't care to take 10,000 samples by hand)

Some curious things about this:
There is a sudden drop in current at 10v (about 16800 RPM on the motor shaft)
At this drop, the sound of the motor changes. Before, it is somewhat buzzing, and afterwards it is quiet and smooth.
After the sudden drop, current continues to decrease.
Speed remains proportional to Voltage, regardless of current.

Some more about my setup:
I'm using an rs550 motor with a Banebots 20:1 planetary transmission. This is attached via chain and sprockets (at a 2:1 ratio) to a small wooden wheel. (The wheel serves as a temporary until I get around to making mecanums for my half-size testing 'bot.)


I'm guessing this particular point is specific to this motor, but has to do with the speed of the motor (as opposed to the duty cycle of the Jaguar).


Have you ever seen this before?
What do you think is happening?

kamocat 03-01-2011 18:11

Re: Modeling motor control
 
Here's a drill motor, with no gearbox or pinion attached . I think it's from a 6v Ryobi.

Unfortunately, there's no encoder on it, so I'll have to assume the speed is proportional to voltage.
The current curve seems a lot more regular; there's less noise, and it looks like a continuous function [perhaps 1/x*log(x) ].

Hawiian Cadder 03-01-2011 18:19

Re: Modeling motor control
 
i think that the current has that weird curve is because there is not enough load for it to run at near no load, but there is not enough load for it to run consistently at multiple speeds, try adding some load to the motor and see if that does anything.

Ether 03-01-2011 18:39

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990544)
Here's a drill motor, with no gearbox or pinion attached . I think it's from a 6v Ryobi.

Unfortunately, there's no encoder on it, so I'll have to assume the speed is proportional to voltage.
The current curve seems a lot more regular; there's less noise, and it looks like a continuous function [perhaps 1/x*log(x) ].

Why is the plot of current a series of horizontal lines?





Hawiian Cadder 03-01-2011 18:59

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 990553)
Why is the plot of current a series of horizontal lines?






account for error i believe.

Ether 03-01-2011 19:01

Re: Modeling motor control
 
Quote:

Originally Posted by Hawiian Cadder (Post 990561)
account for error i believe.

If he is setting the voltage and measuring current, I would have expected the error bars to be vertical.




Hawiian Cadder 03-01-2011 19:10

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 990565)
If he is setting the voltage and measuring current, I would have expected the error bars to be vertical.



that is a good point, perhaps it is just a method for filling in an area, but i would think that would make it a solid color.

Joe Ross 03-01-2011 19:25

Re: Modeling motor control
 
I suspect the horizontal lines are due to quantization error in the current measurement and exacerbated by a large number of data points.

Ether 03-01-2011 19:40

Re: Modeling motor control
 
Quote:

Originally Posted by Joe Ross (Post 990577)
I suspect the horizontal lines are due to quantization error in the current measurement and exacerbated by a large number of data points.

Good point Joe. That would explain it.

@Marshal: can you confirm this? Is the resolution of your current measurements ~130ma ? Also, is there noticeable change in the sound of the motor as the peak of the current curve is reached and the current starts to decrease?




kamocat 03-01-2011 19:49

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 990583)
Good point Joe. That would explain it.

@Marshal: can you confirm this? Is the resolution of your current measurements ~130ma ? Also, is there noticeable change in the sound of the motor as the peak of the current curve is reached and the current starts to decrease?



Yes, that is the resolution. I can't get any data between those increments.
(By the way, there's 10,000 points of data on these graphs. They're in power increments of 1/1000, with 10 samples at each increment)

The data in these graphs have not been processed, aside from scaling speed to account for the gearbox ratio and encoder placement.

If you're talking about the second motor, yes there is a change in sound, but it's a lot harder to hear because there's no sudden change.

kamocat 03-01-2011 20:28

Re: Modeling motor control
 
Quote:

Originally Posted by Hawiian Cadder (Post 990549)
i think that the current has that weird curve is because there is not enough load for it to run at near no load, but there is not enough load for it to run consistently at multiple speeds, try adding some load to the motor and see if that does anything.

How should I create additional load in a repeatable way?

What would this tell me?

EDIT:
Are you saying the motor speed isn't repeatable?
Based on the first graph, we saw that the speed is directly proportional to current, with fairly tight control. It's only the current that is doing funny things.
I can tell you that at full voltage, it's operating pretty close to no load, under peak efficiency. Below that speed, I have no data. That's why I'm doing this test.

Ether 03-01-2011 20:45

Re: Modeling motor control
 



Marshal, I know you have read this thread, but for others who have not, it provides some additional background discussion and links to external info about no-load current vs voltage.



kamocat 03-01-2011 21:05

Re: Modeling motor control
 
I'm not sure why my data differs so vastly from those assumptions.

Ether 03-01-2011 21:06

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990637)
I'm not sure why my data differs so vastly from those assumptions.

Perhaps because you are comparing apples to oranges.

Do you have an FP or a Globe motor, like the ones referenced, that you could run on your test setup ?



kamocat 03-01-2011 21:11

Re: Modeling motor control
 
I have a globe motor, but the current is too small to measure with a Jaguar.
I don't have any Fisher Price motors (but plenty of different drill motors).
I'm going to try to get ahold of a CIM with a toughbox and encoder, but I may not get that for a few days.

Ether 03-01-2011 21:18

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990641)
I'm going to try to get ahold of a CIM with a toughbox and encoder, but I may not get that for a few days.

If you run a CIM with a toughbox, what do you expect to compare that data to? There is no manufacturer's data for this. Still apples and oranges.

Quote:

I have a globe motor, but the current is too small to measure with a Jaguar.
If you run the CIM w/o the toughbox, the no-load current is too low to measure with any accuracy with the Jag, isn't it?



kamocat 03-01-2011 21:59

Re: Modeling motor control
 
The current just needs to be greater than 1A to be measured.

The point of measuring a CIM with a toughbox is to see if it still has these strange current characteristics.

Ether 03-01-2011 23:13

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990664)
The current just needs to be greater than 1A to be measured.

Per the datasheet, the accuracy of the Jag's current measurement is +/-2 amps for currents less than 8A. The no-load current for the CIM is 2.7 amps.

Quote:

The point of measuring a CIM with a toughbox is to see if it still has these strange current characteristics.
The point of measuring something for which you have manufacturer's data is to validate your test method. It is possible that the funky data is a problem with your test method.

Just sayin'




theprgramerdude 03-01-2011 23:43

Re: Modeling motor control
 
Would it be better to hook up (not really) a magnetic current monitor outside the wires to measure current that way? It might have a more accurate current reading, if you can find a model that can handle such low currents and ignore any interference from the motor.

kamocat 04-01-2011 02:32

Re: Modeling motor control
 
I have a old current clamp I'm trying to get working.
I found most of my motors are too small to be measured by the Jaguar.
There also may be some issues with varying Jaguar accuracy as the PWM duty cycle changes.

Al Skierkiewicz 04-01-2011 08:48

Re: Modeling motor control
 
Guys,
I think you are documenting the interaction of a few different elements in the way you are making your measurements. You first have the brush spacing/segment frequency to deal with. Then you have the inductance of the motor vs. the switching frequency of the Jaguar. And finally you have the sample rate of the current monitor in the Jaguar.
It is well documented that the higher switching frequency of the Jaguar does limit current at lower PWM values in higher power motors. This is due to the finite rise time of the applied pulse interacting with the motor internal inductance. It is one of the things that make the Jaguar seem more linear than Victors. Obviously this much more pronounced with CIM motors and FP than with the window motors or the Banebots. At small pulse widths and large inductances, the voltage at the motor terminals never reaches the supply voltage.
If the sample rate or time are sufficiently long enough, at lower RPMs, you will undoubtedly read the current through two windings (while the brush covers two segments) causing a higher reading. As the motor achieves higher RPM, the sample rate likely moves to a point where most current is read while the brush is on only one segment and therefore lower.
There is likely to be significant interaction between the current pulse sampled by the series resistor in the Jaguar and ADC used to transmit the current back to the CAN bus.
My suspicion on the Ryobi drill motor curve is likely due to hysteresis in the core of the motor at lower pulse widths and it's design for increased torque at a specific RPM.
BTW, we should also take into account the rather strange, very short, voltage spikes that occur with Jaguars at the pulse edges under certain conditions. These vary with motors and speed.

kamocat 04-01-2011 12:31

Re: Modeling motor control
 
In other words, the motor current (as measured by the Jaguar) is useless for determining the torque output?

Ether 04-01-2011 13:16

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990837)
In other words, the motor current (as measured by the Jaguar) is useless for determining the torque output?

At very low torques (like no-load), probably. Look at the datasheet. The accuracy is +/-2amps for currents <8amps.

That's why you always want to validate your test method against something that is known, before using it to gather data for an unknown.

The Black Jag uses an INA193AID current-sense chip across a 0.001 ohm shunt in the high side of the bridge. The INA193's analog output is sent directly to an ADC pin in the Jag's LM3S2616 microcontroller, without any hardware (RC) filtering.

So... it depends on what the LM3S2616 firmware is doing. Is it doing some sort of digital filtering? Is it timing the ADC samples to remain phase-locked with the bridge switching? Unless someone intimately familiar with the design is willing to comment, the best way to tell is to compare the Jag's current sense values with oscilloscope current waveform traces taken across an external precision shunt, under various test conditions.



Al Skierkiewicz 04-01-2011 13:28

Re: Modeling motor control
 
Marshall,
If your desire is perfectly accurate current then the answer is no. If you are trying to model some sort of feedback loop, then the answer is yes. It will take some experimentation and noise filtering but teams did use current feedback through the CAN bus last year. Can you answer how you measured the voltage? The reason I ask is that except for the low pulse width signals, the voltage to the motor is swinging between 0 and power supply volts or ~12 volts. The average voltage can be calculated from the pulse width but may not be accurate. For those that are trying to correlate real world performance to the manufacturer's published data need to remember the the factory testing is performed using a high current, lab grade, low impedance, stable voltage source. The battery, wiring and Jaguar do not come close to factory testing so although one can come close, there is no way to exactly duplicate factory published data.

Ether 04-01-2011 14:10

Re: Modeling motor control
 


So as not to highjack this thread, I started a new thread to discuss technical details of the Jaguar current-sense implementation.


kamocat 04-01-2011 14:23

Re: Modeling motor control
 
I measured voltage with the Jaguar. (In the November 2010 spec for the CAN interface, there is an option to get the output voltage as a voltage, rather than a percent. I believe this multiplies the output percent by the Vbus. There is no info on this in the MDL-BDC24 datasheet.)
No, I have not compared this to another device.

If I have to calibrate this as well, I'm not sure the Jaguar is a feasible option for what I'm trying to do.

Let me step back a bit and ask how much it will help me to have an accurate measurement of current.
Is output torque still proportional to current, even at reduced voltage?

Ether 04-01-2011 14:32

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 990937)
Is output torque still proportional to current, even at reduced voltage?

Yes and no. Depends on what you mean in this context by current and torque.

The average torque generated by the motor is proportional to the algebraic average current, assuming Kt is constant (which in real life it is not, but for most practical purposes it is assumed to be).

The output torque at the motor shaft is equal to the torque generated by the motor, minus the torque losses within the motor.



Joe Ross 04-01-2011 14:42

Re: Modeling motor control
 
What was the voltage source for your test? Were you using the jaguar %VBus mode or the voltage mode? Did you monitor the voltage of the voltage source over time? What was the sample rate (related question, how long did the test run)?

kamocat 04-01-2011 16:49

Re: Modeling motor control
 
I'm using an 18AH AGM battery comparable to the KOP Gel-cell.
I'm using %VBus mode, but the voltage jitter in the output is negligible. (It's plotted according to the output voltage, not according to time)
The test takes a little over 1,000*200ms, or a about 3.5 minutes.

For vBus, I looked at it while I was testing, but I didn't record it. It went from approximately 12.7v at the beginning to 12.3v at the end.
Considering I'm plotting them according to the output voltage, this shouldn't be an issue.

The way I have this setup is I'm setting the output, waiting 200ms, and then requesting [current, vBus, speed, vOut] for 10 iterations in a For loop. I'm not measuring the time between those samples.

Jared Russell 04-01-2011 17:19

Re: Modeling motor control
 
Over 3.5 minutes of operation, I could imagine motor heating affecting torque output.

kamocat 04-01-2011 17:30

Re: Modeling motor control
 
The motors are barely warm.
I think I have to run them for 10-15 minutes at full power to warm them up.

Al Skierkiewicz 04-01-2011 18:47

Re: Modeling motor control
 
Marshall,
In looking at the schematic, the data for Vout would appear to be a calculation based on the supply voltage to the output stages (Vsense) and the percent of the output PWM commanded for output. In most cases, this should give you good data in the normal operating range for FRC motors. It cannot compensate for voltage drops due to wiring and motor lead length nor can it compensate for LR distortions at low values of pulse width as discussed earlier. At true free speeds, is likely to be inaccurate as well.

As an edit, I just thought of something. Are these brand new motors that you are testing? There may be some discontinuity while the brush assembly is wearing into the commutator shape. Also, I wonder what the reaction time to a command is once the motor starts to speed up. It surely will take a finite time to get the mass moving at a new speed. I wonder if 200msec is long enough. (thinking out loud here)

kamocat 04-01-2011 19:15

Re: Modeling motor control
 
Would you give an estimate on the accuracy?

Neither of these motors are new. The first one has at least 20 hours of sine-wave operation. The second one has been used as a drill and a robot manipulator.

Al Skierkiewicz 04-01-2011 19:21

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 991171)
The first one has at least 20 hours of sine-wave operation.

Can you explain that?
I wouldn't know where to start with an estimate. I am wondering why you are trying to evaluate for torque now that we have arrived at this spot. Except for the low RPM, you should be able to make calculations from the current and motor voltage since the variables will remain rather constant. Are you just trying to keep part count low?

kamocat 04-01-2011 19:24

Re: Modeling motor control
 
I'm trying to make this software based, using hardware other teams have easily available.
It's a motor-selection tool, to determine the speed and torque requirements of your mechanism.

Chris is me 04-01-2011 19:43

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 991185)
I'm trying to make this software based, using hardware other teams have easily available.
It's a motor-selection tool, to determine the speed and torque requirements of your mechanism.

Why not mathematically solve this using motor specifications and force / torque calculations?

Kevin Sevcik 04-01-2011 20:04

Re: Modeling motor control
 
I've now deciphered the current sampling strategy employed by the Jaguars. It's a pretty simple scheme, they probably just wanted a robust fast solution over the broad range of motor inductances, etc. Anyways, the current, bus voltage, analog input, and temperature are sampled every PWM cycle, with an offset to put the sample in the middle of the PWM pulse (15.625 kHz). Voltage, analog, and temperature are used as-is, no filtering whatsoever.

The voltage returned over CAN is, indeed, the instantaneous bus voltage scaled by the percent command.

Current, on the other hand, is put through a 16x super-sampling, 8-point moving average filter. That is, 16 consecutive samples are put into a bucket, and when the bucket is full, it's averaged with the last 7 buckets, and that's your new current value till the next bucket's full.

So you end up with something like a 976Hz update rate for the current, but a bandwidth of something like 122Hz or less. Of the instantaneous value in the middle of the PWM pulse, lest we forget. This is the value reported back over CAN, and also used for current control mode. Interestingly, the instantaneous value is used for I2T overcurrent protection, which is set for 23A over 46A for 2 seconds (ie. 69A for 2s, or 78A for 1s, etc.).

No, I don't know why the overload specs differ from the specs in the data sheet. Either they fudged the DS numbers down for safety, or their conversion functions are wrong by that amount, which seems unlikely.

This is all assuming the FRC firmware is identical in these regards to the reference design firmware on Luminary Micro's site, of course. I'm not going to decompile the FRC firmware unless lives are at stake of something.

Ether 04-01-2011 20:22

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 991257)
I've now deciphered the current sampling strategy employed by the Jaguars...

current... [is] sampled every PWM cycle, with an offset to put the sample in the middle of the PWM pulse...

Current ... is put through a 16x super-sampling, 8-point moving average filter.

Nice work! Thank you for this information!

So the Jag firmware is doing both: digital filtering and phase-locking the sample to the bridge switching.

Quote:

So you end up with something like a 976Hz update rate for the current, but a bandwidth of something like 122Hz or less.
Well, the 976Hz makes sense, since the PID in the Jags is updated at about the same rate.

Quote:

Of the instantaneous value in the middle of the PWM pulse, lest we forget.
Right. Now the question now becomes: what is the relationship between this metric, RMS, and algebraic average.






EricVanWyk 04-01-2011 22:02

Re: Modeling motor control
 
Marshall -

To account for motor heating, consider re-ordering your tests pseudo-randomly. This will spread the time dependent effects across your sample space. Hopefully, this will result in a curve that makes more sense (but will likely be "wider").


Calculating effective motor voltage from Vbus * Duty Cycle is actually a pretty good method as long as the motor current is continuous (doesn't go to zero), and your measurement of Vbus is good enough.

Measuring Vbus half way through the pulse is a reasonably standard method. Assume that the applied voltage waveform looks roughly like a trapezoid: It starts at Vbus nominal when the switch starts, linearly(ish) droops due to increasing IR loss, and then goes to zero when the switch stops. The measured Vbus looks just like this, but with some ugly ringing around the transitions. By measuring halfway through, we kill two birds:
1) We are far away from the ringing.
2) We effectively take the average of the Vbus across the cycle (if it droops linearly).
Pretty sweet, eh? Simple way to get a darn good estimation. If you think about 2) a bit, you'll see why there usually isn't a filter in place - it would mess up the reading! If there is one, it usually has a very small time constant compared to the pulse width.

Continuous current is absolutely key to using effective motor voltage calculations - if the current stops, the underlying assumptions fall apart entirely. This is "The Big Difference"(TM) between Jaguars and Victors, and is why they have such different responses.
In a continuous current control mode, the effective motor voltage is (nearly) equivalent to what would happen with a pure DC source of the same voltage.

The reason for this gap is that when current is stops flowing, the motor is effectively floating with no applied voltage. If current is always flowing, the motor controller is always in control of the applied voltage.

Continuous current occurs whenever the off period is shorter than the amount of time it takes the current to decay to zero. Mathematically, this puts a relationship between switch frequency (on and off periods, actually) and minimum average current. That is to say that for a given frequency and duty cycle, there is a minimum average current to establish continuous current control. For a Jaguar, this is a few amps. For a Victor, this is a few hundred.

kamocat 04-01-2011 23:13

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 990946)
The average torque generated by the motor is proportional to the algebraic average current, assuming Kt is constant (which in real life it is not, but for most practical purposes it is assumed to be).

The output torque at the motor shaft is equal to the torque generated by the motor, minus the torque losses within the motor.

Is torque loss proportional to speed of the motor?


Will 5A at 4v produce the same internal torque as 5A at 10v?

Is the internal torque of a GEARBOX proportional to its speed?

kamocat 04-01-2011 23:52

Re: Modeling motor control
 
Here's a CIM with a toughbox, using the same measurement system. Sorry, there's no encoder on it yet.


EDIT:
Here's a test using a random sampling sequence.

Ether 05-01-2011 01:24

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 991394)
Is torque loss proportional to speed of the motor?

It depends on what you mean by "proportional". To me, "proportional" means means a y=k*x relationship. So the answer is no, because at zero speed there is a non-zero static friction torque loss.

Is torque loss linear with speed? Not really, but for simplicity it is usually modeled that way. For example, see this spreadsheet.

Here are some interesting links about internal torque loss vs speed for Globe and FP motors.


Quote:

Will 5A at 4v produce the same internal torque as 5A at 10v?
To a very good approximation, yes, as long as we're talking about the same waveform of 5A in each case.

Quote:

Is the internal torque of a GEARBOX proportional to its speed?
Well, it can vary with speed. A gearbox has static friction. It also has a speed-dependent loss. Both types of loss can vary substantially from one gearbox to the next, even for identical models. Even for one given gearbox the losses can vary as a function of temperature, lubrication, contamination, etc.



Ether 05-01-2011 01:28

Re: Modeling motor control
 
2 Attachment(s)


Look at the difference in current waveforms for a CIM with locked rotor driven at 5% duty with a Jag vs a Victor.

This is a simulation using R=0.090 ohm & L = 200uH.


At 15KHz, the current varies from ~7.4amps to 7.7amps. The RMS is 7.6amps and the algebraic average is 7.6amps.

At 150Hz, the current varies from ~1.8amps to 18.7amps. The RMS is 8.4amps and the algebraic average is 6.7amps.

Since average motor torque is created by algebraic average current, and motor heating is created by RMS current, the 150Hz waveform produces less average torque and more motor heating.




kamocat 05-01-2011 02:05

Re: Modeling motor control
 
Thank you for the straightforward answers.

Quote:

Originally Posted by Ether (Post 991420)
Quote:

Originally Posted by kamocat
Will 5A at 4v produce the same internal torque as 5A at 10v?

To a very good approximation, yes, as long as we're talking about the same waveform of 5A in each case.

How would I measure it in a way that any waveform with the same current would create the same torque? You said algebraic average?

Ether 05-01-2011 02:32

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 991432)
Thank you for the straightforward answers.

How would I measure it in a way that any waveform with the same current would create the same torque? You said algebraic average?

That's a fair question but the answer has a lot of ifs, ands, and buts.

If the waveform is nice and flat like a 5% 15Khz CIM curve then any sample taken with be both the algebraic average and the RMS, approximately.

If the waveform is an exaggerated sawtooth like a 5% 150Hz CIM curve, then you'd have to sample the instantaneous current and run it through a low-pass filter of some sort. You'd have to make sure your samples captured a reasonable picture of the entire waveform and were set up in such a way that aliasing didn't distort the results. OR, I think a better way would be to hardware-filter the raw analog signal (the amplified voltage across the shunt resistor) before it goes to the ADC. I think a filter could be designed that would give the algebraic average.



Al Skierkiewicz 05-01-2011 08:33

Re: Modeling motor control
 
Quote:

Originally Posted by EricVanWyk (Post 991357)
That is to say that for a given frequency and duty cycle, there is a minimum average current to establish continuous current control. For a Jaguar, this is a few amps. For a Victor, this is a few hundred.

Erik, can you explain this?

Ether, in the graphs you posted for a locked rotor CIM it appears that the Victor has a distinctive current inductance charge/discharge curve while the Jaguar does not. The inductance charge is much more pronounced in the Jag due it's higher frequency. The charge current rise is very long compared to the pulse width at 15kHz. Using the values R=.090 and L=200uH, the time constant is 2.2msec or full current will only be achieved through the motor in 11 msec.
At 150 Hz and 5% duty cycle that is an ON time pulse width of .33msec so the current will reach 18.35 amps by the end of the pulse for a Victor. At 15kHz and 5% duty cycle that is an ON time pulse width of 3.3usec and the current will only reach 0.199 amps by the end of the pulse for the Jaguar. Neither controller provides a discharge path during the OFF period. It is this phenomena that gives the Jag it's apparent linear response.

Ether 06-01-2011 11:35

Re: Modeling motor control
 
Quote:

Originally Posted by Al Skierkiewicz (Post 991458)
Neither controller provides a discharge path during the OFF period. It is this phenomena that gives the Jag it's apparent linear response.

The FETs in both the Tan and the Black Jags have a zener diode to provide a path for the current to keep flowing through the motor during the OFF portion of the cycle.

http://www.chiefdelphi.com/forums/sh...30&postcount=9

The Jag's linear response is due to its higher switching frequency, which creates an effectively flatline current waveform whose amplitude (which is the average since the wave is flat) varies linearly with the voltage duty cycle.

The Vic's slow switching frequency allows to current to decay to zero during the off portion. The average value of this sawtooth waveform does not vary linearly with the voltage duty cycle, so neither does the motor torque.



Al Skierkiewicz 06-01-2011 12:18

Re: Modeling motor control
 
The FETs in both Jags and Victors have a forward voltage drop around 1 volt. Therefore to make these conduct (when OFF) would require that the motor be generating at least 2 volts more than the power supply.

Kevin Sevcik 06-01-2011 12:51

Re: Modeling motor control
 
Actually, you're both wrong. Sort of. The control scheme for the motor only pulses the high side FET for a direction, and leaves the low side FET on. So one low side FET remains conducting during the entire PWM cycle, and you only have the forward drop from the opposing low side FET when the current cycles back through in that direction. And since we're talking about the motor inductance driving the current in the off phase, the voltage is going to increase to compensate for that 1V drop anyways.

Ether 06-01-2011 13:59

Re: Modeling motor control
 
1 Attachment(s)
Quote:

Originally Posted by Kevin Sevcik (Post 991958)
Actually, you're both wrong. Sort of. The control scheme for the motor only pulses the high side FET for a direction, and leaves the low side FET on.

Just to be clear: I didn't say that the Jag turns the low side FET off for pulsing. I just showed what the current path would look like if it were switching the low side... and I asked if anyone knew, definitively, what the switching method is:
See attached images. For simplicity, I showed path through only one FET of each pair, and only for + currents. Green path is during ON portion. Blue path is during OFF portion (for high-side switching). Red path is during OFF portion (for low-side switching).

I don't know if the Jags use high-side, or low-side, or some other switching method. Does anyone know, definitively, what switching method the Jags use? I've heard many different claims.

How do you know that the Jag switches only the high side? Did you discover this during your analysis of the firmware, that you posted earlier? Or did you find it in some document somewhere?


Quote:

So one low side FET pair remains conducting during the entire PWM cycle, and you only have the forward drop from the opposing low side FET pair's zener diodes when the current cycles back through in that direction.
I added the bold stuff for clarity. You also have the opposing back emf if the motor is spinning. See attached PDF.


Quote:

And since we're talking about the motor inductance driving the current in the off phase, the voltage is going to increase to compensate for that 1V drop anyways.
Exactly. See attached PDF.



Al Skierkiewicz 06-01-2011 14:55

Re: Modeling motor control
 
The only knowns are the Victors turn off both high and low side FET groups except when "brake" mode is enabled and throttle is zero. Luminary reps (a while ago) posted that the tan Jags only turn off the high side FETs while leaving the low side FETs turned on for direction. "Brake" operation is the same. I have no known source for operation on the black jags but assume there was no change.
While the Jags only turn off one FET group, they also have the current sense resistor (.0005 ohm for tan and .001 for black) in series with the discharge path to battery. Again, this path to the battery only exists while the voltage generated in the motor can forward bias the body diode(s).

Kevin Sevcik 06-01-2011 15:07

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 991988)
How do you know that the Jag switches only the high side? Did you discover this during your analysis of the firmware, that you posted earlier? Or did you find it in some document somewhere?

Yup. Again, with the caveat that I looked at the reference design source code for the Tan Jag. YMMV with the FRC firmware, though I'd be terribly surprised if they changed much, as the reference design looks very good and entirely functional for FIRST purposes.

Ether 06-01-2011 15:30

Re: Modeling motor control
 
Quote:

Originally Posted by Al Skierkiewicz (Post 992005)
While the Jags only turn off one FET group, they also have the current sense resistor (.0005 ohm for tan and .001 for black) in series with the discharge path to battery. Again, this path to the battery only exists while the voltage generated in the motor can forward bias the body diode(s).

The current we are discussing in this thread is the current that flows through the motor during the off portion of the duty cycle. This current does not flow through the current sense resistor. It does not flow to the battery.



Kevin Sevcik 06-01-2011 16:01

Re: Modeling motor control
 
Hey all. Just to add to the confusion and all, the Black Jags seem to operate somewhat differently than the Tans. I know, I was surprised too. Anyways, the reference design of the Black Jags is also high-side switching, BUT it switches the high and low side FETS on the pulsed leg.

Ex: at +25% command, M- low is ON, M+ high is ON 25% of the cycle, M+ low is ON 75% of the cycle.

So on the Black Jags, you don't need to worry about any diode drops in the off phase, save for the vanishingly small slice of dead time to prevent shoot through.

Isn't this so much more fun than rumor mongering?

Ether 06-01-2011 16:07

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 992030)
Isn't this so much more fun than rumor mongering?

Yes. You are the man !



Ether 06-01-2011 16:53

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 992030)
Ex: at +25% command, M- low is ON, M+ high is ON 25% of the cycle, M- low is ON 75% of the cycle.


Did you mean M+ low ?



Kevin Sevcik 06-01-2011 17:26

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 992054)
Did you mean M+ low ?

Erm.. Typo? What typo? But yes, thanks for the catch.

kamocat 06-01-2011 18:19

Re: Modeling motor control
 
This is very noticeable in motor control when you're slowing down, BTW.
If you go from 100% voltage to 10% voltage on a Tan Jag, the motor just coasts down. If you do the same on a Black Jag, the motor jumps down in speed.

Ether 06-01-2011 18:44

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 992087)
This is very noticeable in motor control when you're slowing down, BTW.
If you go from 100% voltage to 10% voltage on a Tan Jag, the motor just coasts down. If you do the same on a Black Jag, the motor jumps down in speed.

Was the jumper set for "coast" on the Black Jag when you ran this test ?



kamocat 06-01-2011 18:55

Re: Modeling motor control
 
Remember this thread?
http://www.chiefdelphi.com/forums/sh...733#post973009

EDIT:
I believe it did happen both in brake and coast mode on the Black Jaguar. It was one of the things I discovered when I was first playing with the BDC-COMM.

EDIT2:
Yes, this happens in coast mode. I just checked, and I keep my jumpers in coast position so I don't have the trouble with Jaguars failing from power generated by the motors when the robot is off.
I was experiencing this locked anti-phase when I was testing yesterday.

Ether 06-01-2011 19:15

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 992113)

Yes, I remember it :-(

The "Black Jags use locked antiphase" was based on a post by Gdeaver that sat there unchallenged after several subsequent posts and so I assumed it was true (slaps side of head).

Now, along comes Sir Kevin and enlightens us on this matter: Black Jags alternately connect the motor to power and short it.



kamocat 06-01-2011 20:36

Re: Modeling motor control
 
Hmm. It seems the datasheet I linked was for the Tan Jaguar. (Again, the Fairchild part should have tipped me off.)
The Black Jaguar controls all four MOSFET sets with 4 IO pins, and uses an Allegro A4940 to drive the MOSFETs.

So that would imply the Tan Jaguar is locked antiphase. And yet it doesn't have the response I would expect. Strange.
It appears the Tan Jag uses 4 outputs as well: two for each PWM driver.

EDIT:
So what do you think about this post by EricVanWyk? Should we ask him for clarification? Did he confirm that locked antiphase exists, or that it is implemented on the Tan Jaguars, or that it is implemented on the Black Jaguars?

Ether 06-01-2011 21:32

Re: Modeling motor control
 
Quote:

Originally Posted by kamocat (Post 992168)
EDIT:
So what do you think about this post by EricVanWyk? Should we ask him for clarification?

The question has already been asked here and here.

The answer was given here.



kamocat 06-01-2011 23:38

Re: Modeling motor control
 
I was just asking because he said he had observed the behavior.

Nevertheless, we've looked at the hardware and software for the Black Jaguar.
I know from observation that the Tan Jaguar controls differently. I get the impression it alternates between power and open, but I'm curious HOW it does this (does it modulate the OutputDisable?).

At any rate, I need to get my current clamp working so I can accurately measure current.

Kevin Sevcik 07-01-2011 00:13

Re: Modeling motor control
 
Too much crosstalk between this thread and the current sensing thread... but yes, the tan jags are modulating the output disable pin. They could be programmed to modulate the pwm pin but aren't for some reason. I obviously can't say if it's to get that particular dynamic or to avoid shoot through, but there it is.

Kevin Sevcik 07-01-2011 00:45

Re: Modeling motor control
 
Alright, I'm transferring a post from the current sensing thread over here to keep things better organized.

Quote:

Originally Posted by kamocat (Post 992244)
No, they can't modulate the PWM pin. If they did, that would be locked antiphase, because the MOSFET driver would alternate between driving the low side and driving the high side.

Noooo, the Jags aren't operating in locked anti phase, and the tan wouldn't if the PWM pin was modulated.

Locked anti-phase required reserving the entire h-bridge to go from forward bias to reverse bias in respective PWM phases. It's a Forward-Reverse phase modulation. That's definitely not what either Jag is doing.

Both Jags hold one half of the h-bridge constant. So in forward motion, the M- half is held high-OFF, low-ON for the entire PWM cycle. In the Tan Jags, the M+ high side is selected via the PWM pin, and the output disable is modulated, so the M+ low side would never turn on. So that's a Forward-Open modulation. The Black Jags do things differently and alternately drive the M+ high and low sides. That's a Forward-Shorted modulation, because we never turn on the M- high side.

So I was suggesting that the Tan hardware seems perfectly capable of the same Forward-Shorted operation as the Black if they modulated the PWM pin instead of the Output Disable pin.

kamocat 07-01-2011 01:06

Re: Modeling motor control
 
Oh, you're right, my mistake.
If they modulated the PWM pin, it would have the same control as the Black Jaguar.
Isn't that interesting? I wonder why they haven't changed that yet.

Kevin Sevcik 07-01-2011 10:15

Re: Modeling motor control
 
They very well may have changed it for the FRC firmware. Again with my caveats that this is all based off the reference source code released by Luminary Micro, which may not be identical to the FRC firmware. I'm not much interested in hunting up a disassembler for pick apart the FRC firmware just to double check things though. Anyways, the only reason I can think of for not doing it is if the don't trust the dead time protection in their FET drivers.

FETs all have some delay between turning off the gate supply and when conduction actually stops. So if you're simply turning off the high side and turning on the low side at the same instant, you can get "shoot-through" where you've actually shorted V+ to V- for some small amount of time. This is obviously bad, so most integrated FET drivers have provisions for adding "dead time" between turning one side off and the other on. The Tan Jag's driver says it has built in dead time, but Luminary Micro may not have trusted it, or may have discovered a problem with their implementation of it. Or they may have just not wanted bother with the possibility of a problem.

Al Skierkiewicz 07-01-2011 11:17

Re: Modeling motor control
 
It may well have been to help the bootstrap work.

Ether 07-01-2011 14:01

Re: Modeling motor control
 
2 Attachment(s)
Quote:

Originally Posted by Ether (Post 992125)
Black Jags alternately connect the motor to power and short it.

So what happens to the current in a spinning motor when it is shorted?

The simple answer is, the motor's inductance forces the current to keep flowing for a few microseconds, before the motor's back emf overpowers the inductance and reverses the current.

This momentary forward current continues applying torque during the few microseconds that it is flowing.

With a Jag, operating at 15000Hz, the pulse width is shorter than the decay time, so it makes sense to short the motor during the OFF cycle, to let the good (forward) current keep flowing.

With a Victor, operating at 150Hz, the pulse width is far longer than the decay time, so it the motor were shorted, the back emf would have time to overpower the inductance, and you'd get reverse current (and reverse torque) during the OFF portion of the PWM.

See attached PDF (analytical solution) or PNG (numerical solution) for more technical detail.



Ether 07-01-2011 15:23

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 992255)
Both Jags hold one half of the h-bridge constant. So in forward motion, the M- half is held high-OFF, low-ON for the entire PWM cycle. In the Tan Jags, the M+ high side is selected via the PWM pin, and the output disable is modulated, so the M+ low side would never turn on. So that's a Forward-Open modulation. The Black Jags do things differently and alternately drive the M+ high and low sides. That's a Forward-Shorted modulation, because we never turn on the M- high side.

Just to clarify, even with "Forward-Open", the Tan Jag still has a path for the current through the Q4,5,&6 Zener diodes.



Kevin Sevcik 07-01-2011 15:46

Re: Modeling motor control
 
Quote:

Originally Posted by Ether (Post 992459)
Just to clarify, even with "Forward-Open", the Tan Jag still has a path for the current through the Q4,5,&6 Zener diodes.

Yes, but with a 1V drop, which will drain the current a fair bit quicker. And the more important difference that if your current decays quick enough that you'd start regenerative braking, the diodes will stop that. So the "Forward-Open" mode has an advantage in the (rare) case that a motor is turning fast enough with low enough current that you'd encounter reverse torque.

Come to think of it, this explains Marshal's report of different operating characteristics between the tan and black jags. If you're running the motor at high/full speed and drop to a lower PWM command, the current will decay quicker in the tan jag, but you'll never get reverse torque, so you'll "coast" during the off cycle. In the Black Jag, there's a path for reverse current during the off cycle, so it's possible for the back emf to build up a reverse current and create reverse torque to slow the motor down quicker.

I think this makes sense, but I don't have any simulations set up at the moment to test it.

Ether 07-01-2011 17:10

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 992480)
Come to think of it, this explains Marshal's report of different operating characteristics between the tan and black jags. If you're running the motor at high/full speed and drop to a lower PWM command, the current will decay quicker in the tan jag, but you'll never get reverse torque, so you'll "coast" during the off cycle. In the Black Jag, there's a path for reverse current during the off cycle, so it's possible for the back emf to build up a reverse current and create reverse torque to slow the motor down quicker.

I think this makes sense, but I don't have any simulations set up at the moment to test it.

That is a reasonable hypothesis, and makes sense intuitively, but the analysis doesn't support it (unless my math or assumptions are wrong - which is certainly possible).

With a CIM and a Black Jag: even if the CIM is going at full throttle no-load, it takes almost 45 microseconds for the 2.7amp no-load current to decay to zero if you short the motor. The Jag's PWM period is 33 microseconds.



Ether 07-01-2011 18:02

Re: Modeling motor control
 
Quote:

Originally Posted by Kevin Sevcik (Post 992480)
Yes, but with a 1V drop, which will drain the current a fair bit quicker.

I plugged an additional 1 volt into the analysis mentioned in my earlier post; it makes very little difference with a CIM.

I don't have L values for other motors.

Quote:

And the more important difference that if your current decays quick enough that you'd start regenerative braking, the diodes will stop that. So the "Forward-Open" mode has an advantage in the (rare) case that a motor is turning fast enough with low enough current that you'd encounter reverse torque.
Good point. That may (or may not) happen with other motors.




All times are GMT -5. The time now is 21:56.

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