Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

How is the NI-9505 'current sense' measured?

Solved!
Go to solution

All,

 

I am interested to hear how well this code works.   Does it improve the performance significantly?  Is it easier to tune the controller?  Any feedback is appreciated.

 

Thanks,
Lorne Hengst

Motion Control Product Support Engineer

0 Kudos
Message 21 of 54
(3,238 Views)

All,

 

I meant to address one of the previous questions in my las post, but I forgot to.  So, here it is...

 

Estern had asked, why do we sample the current at the halfway point of the "on" portion of the PWM pulse?

 

If the inductance of the load is high enough, the current in the load will never reach peak current (Vbus/Load Resistance) during the short "on" pulse.  Rather, the current will be ramping up during the entire "on" pulse and ramping down during the "off" pulse.  Measuring current halfway through the "on" pulse wil allow us to roughl measure the average current over the entire PWM period (see the attached picture).  If your inductance is too low, the current will ramp up to the peak current before the "on" pulse ends, and yes, you will have a bad current reading.

 

If you find that your current is not steady enough, one trick you can implement into your code is to increase the frequency of the PWM signal.  If you do this, your peak to peak current ripple will decrease, but you will need either loose some of your PWM duty cycle precision or you will have to increase your FPGA clock frequency.  Doing this also requires that you modify the PWM generation code to reflect the changes that you made.

 

Lorne Hengst
Motion Control Product Support Engineer

 

 

Message 22 of 54
(3,238 Views)

Lorne,

 

That is a huge effort from you and your research team! So precious!

 

We are in the process of implementing the changes you suggested. We will definitely give you a detailed account on how well the new code peforms.

 

Thank you!

Nic

0 Kudos
Message 23 of 54
(3,214 Views)

Can somebody at NI give a better answer to this question?  I am wondering the same thing - how is the current measured and when is the best time to sample it?

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 24 of 54
(2,595 Views)

Never mind - the answer looks pretty good.  When I posted the previous message, I didn't notice there were three pages to the discussion.  I only saw the first three entries and was very disappointed.  After reading all the later posts, I decided Lorne did an awesome job answering the question.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 25 of 54
(2,593 Views)
Message Edited by Bruce Ammons on 01-20-2010 10:53 PM
Bruce Ammons
Ammons Engineering
0 Kudos
Message 26 of 54
(2,429 Views)

Okay, I will try again.  This is what happens when your message is too long, I guess.

 

Lorne,

 

You asked for some feedback, so here it is.  A little late, but late is better than never.

 

I implemented the routines described in this thread and had a few issues.  To investigate the problems, I wrote a version that samples the current at a different point in the duty cycle each time through the loop.  After 2000 duty cycles, I can construct a graph that shows the entire current waveform.  As long as the system is in a steady state condition, the waveform is quite stable.  I captured a graph for a 25% duty cycle with no load to demonstrate some issues.  Please look at the attached graph.

 

I see a large positive spike in the current at 25 counts when the voltage turns on.  This delay is exactly what you predicted and justifies adding 25 counts to the time you want to sample the current.

 

I see a large negative spike in the current at 559 counts when the voltage turns off.  Ideally it should be at 525, exactly 500 counts after it turns on.  This tells me adding 30 counts to the pulse width is counter productive.  If I hadn't added the 30 counts, the pulse width would be withing a few counts of what was desired.

 

I am not sure about the oscillations near zero current.  Since each data point is captured during a different duty cycle, it is impossible to tell if the current oscillates within a single cycle, or just from cycle to cycle.  Trying a few other sampling schemes would probably clear it up.

 

The problem here is the large spikes.  I don't get anything like what you predicted in your graph, and I am not sure why.  My motor is fairly small - a 24V motor designed for robots.  I added some capacitors to the motor terminals for noise reduction based on the dealer's suggestion.  Could the capacitors be inducing the spikes?  The biggest problem right now is that for short duty cycles, the two spikes run together and make it impossible to accurately measure current during the on cycle.  It might be possible to read it during the off cycle, though.

 

Any thoughts?  I would be happy to discuss this further offline if you want more details.  Just send me an email or call me.

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
Message 27 of 54
(2,427 Views)

That's a great experiment, Bruce - thanks for posting the results.

 

I would agree that the capacitors are probably causing the initial spikes.  I'd be very interested to see whether you get different results without them.

 

Ian

0 Kudos
Message 28 of 54
(2,420 Views)

I removed the capacitors and ran the test again.  The good news is that the spikes are much smaller.  The bad news is that they are still there and I can't accurately measure current.  See attached graph.  Now the oscillations are much more visible.  I noticed the frequency of the oscillations was proportional to the duty cycle.  Perhaps they are related to motor speed or something.

 

I guess the question is why do I still have spikes?  Does my motor not have enough inductance?  Would it make sense to add an inductor in series with the motor to increase the inductance?  How do I configure my system so I can get a reliable reading of current?

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 29 of 54
(2,383 Views)

I ran some more experiments.  I removed the motor and replaced it with a 1000 ohm resistor.  When I run the program, I get spikes in the current with the classic RC exponential decay.  I ran it again with nothing connected (infinite resistance) and 150 ohms.  All three graphs spike at 60 units of current, then level out to the expected current value.  I am guessing the load is parallel to some type of RC circuit inside the 9505, but I am not a circuits expert.

 

One strange thing in all three graphs is that there is a third spike just before 2000 counts.  It looks like the circuit disconnects one source about 30 counts before switching to the other source.

 

I noticed in the 9505 manual that a minimum inductance of 500 mH is specified.  Does that refer to the motor?  Once again, would it be a good idea to add an inductor to get up to that inductance?  Would my motor performance be significantly altered by adding an inductor?

 

Thanks,

 

Bruce

Bruce Ammons
Ammons Engineering
Message 30 of 54
(2,355 Views)