From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computing velocity using labview FPGA

Hello,

 

I'm looking for the best possible approach to compute velocity on LabVIEW FPGA.

 

What I have in entries is a voltage coming from a NI 9201 module. The voltage that I get represents a potisiton. For exemple at the minimum position of my stage, I get -10V and at the maximum position, I get 10V. If the stage doesN,t move, I'll get a constant voltage between -10V and 10V.

 

I was thinking about using a circular buffer using Memory Block to keep the recent position values in memory.

 

Is there a better approach?

 

Thanks!

 

Vincent

0 Kudos
Message 1 of 6
(2,694 Views)

Feedback Node would be the easiest way to keep the previous position.  Then it is just a matter of subtracting the current position and the previous and divide by the loop rate (assuming a single sample per loop iteration).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,673 Views)

Thanks for your answer Crossrulz,

 

What I fear with that simple soltution is that it would be VERY influenced  by signal noise... Especially if the loop rate is fast... I think that the variation of calculated velocity between every loop would be very high... It wouldn't be very stable even if the displacement is stable...

 

Do you agree?

 

Any solution that would be a bit more stable?

 

Thanks!

0 Kudos
Message 3 of 6
(2,665 Views)

Vgravel,

 

For what specific reasons are you concerned about the signal noise?

 

From my understanding, I would agree with crossrulz’s suggestions. The FPGA is designed to be extremely deterministic. You know the delta t of your loop, and from that point you would just need to compare the current position to the previous position and divide by the loop rate to get the velocity. The calculation is going to be pretty straightforward after that. The signal noise shouldn’t be influenced by the acquisition rate. That is going to be determined by the absolute accuracy of the analog input module you are using. Even then, you’re limited by the analog input specifications of the module itself, not necessarily the FPGA.

 

Are you using a specific position sensor?  The spec. sheet should provide some information about possible output sensitivities of the sensor. 

Will M.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(2,636 Views)

vgravel wrote:

Any solution that would be a bit more stable?


You could always throw in a moving average of your position and/or velocity measurements.  That would be a simple filter.  Or you could even throw in a low pass filter.  There are many ways to clean up that signal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(2,623 Views)

Usually you use a FPGA because of speed  🙂

 

So I assume you need the speed as an input for a controller?

 

Your speed calculated by ust two successive values migth be prone to noise.

 

So you apply more points into your speed calculation ..  but taking more and more points  migth delay your results....

The usual way is a FIR filter that do the differentiation and apply some sort of filtering at the same time.   

A nice page on how to optain these filter coefficients is

http://www.holoborodko.com/pavel/

 

. (I would use the Savatzky-Golay filter I posted here ...)  remember: the length of the filter (here in points) define the delay of the result.

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 6
(2,618 Views)