12-02-2008 06:39 AM
Hi
I am using labview 8.5 and an Ni USB 6221 card to control the power output of an actuator and monitor the signal output from a load cell. The actuator provides a force at 50 Hz which is measured by the load cell.
The signal from the load cell is basically a very narrow peak occuring at a 50 Hz. I wish to measure the height of each peak, average the figure (the peak force varies by 2 or 3%) and then use this data to provide a feedback loop to keep the applied force constant.
[img]http://farm4.static.flickr.com/3067/3077344302_4b7bb5f2a3.jpg[/img]
I have tried using the 'amplitude and levels' vi in 'peak' mode and averaging the output. However, this appears to give a widly fluctuating result that is useless for feedback purposes. I have tried increasing the sampling period of this vi with no luck.
Does anyopne have any suggestions on a way to accomplish this? Could i accomplish this using waveform peak detection?
Any help or advice would be greatly appreciated.
Many thanks.
Solved! Go to Solution.
12-02-2008 11:36 AM
Dear,
Since it is not too complicated a problem, I would probably go with the brute force if you cannot figure out why the "amplitude and level" isn't working. The way I would approached this problem is the following:
1 - Continuousy sample the force (1kHz or the frequency you need)
2 - Grab the data and analyze at 40Hz (this garantees you will have at least 1 peak, begin slower than 50Hz)
3 - Transform your waveform to an array
4 - Get the maximum value
5 - Check to make sure it's above a certain threshold (just in case something is wrong with the device, to protect your average)
6 - Throw that value in a circular buffer (to get rid of the oldest measures and only keep the "n" most recent)
7 - Average your circular buffe and take corrective measurement based on this
Hope this help,
Olivier
12-08-2008 06:22 PM
Hi.
Many thanks for your help and sorry for my slow reply!
How do i program a circular buffer in LabView? Would you use this function?
[url]http://zone.ni.com/devzone/cda/tut/p/id/7188[/url]
cheers
John
12-09-2008 06:39 AM
Hi John,
Thanks for your post and I hope your well.
To create a circular buffer in LabVIEW you need to use a shift register. However, for large number of data points having a large shift register on the side of loop is silly and unpractical. Therefore you need to use an array, in which you update the oldest value with the newest value and you set the size of the array to the number of points you wish to have in the buffer.
I have created an example of a buffer in LabVIEW 8.5 - please see attached VI.
Also, if your doing any sort of statical anylsis maybe consider using the point-by-point functions, which only require the most update value to calculate the newest mean (for example). This saves having the compute the entire array everytime.
Hope this helps,
12-09-2008 07:07 AM
Many thanks!
cheers
John