LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare past values in array while data acquisition continues

Hello,

 

I am correctly acquiring data and placing them continuously into an array.  I want to look at the last 5 seconds of data whenever I push a button, in other words pushing the button would work as a time marker to tell labview to look 5 seconds back.  If the values of data contained within the last 5 seconds are all greater than 1, a LED would light on.  If the values of data contained within the last 5 seconds are between -1 and 1 another LED would light on, and finally if the values of data contained within the last 5 seconds are all less than -1, another LED would light on.  Is there a simple way of doing this?  I will appreciate your suggestions, thanks!

 

Best, 

Nestor

0 Kudos
Message 1 of 8
(2,555 Views)

Hello Nestor,

 

What do you have so far?  Do you have a VI you can post?  It's best to experiment around with arrays and see what works.  One problem I see is the timing.  How do you know "how far back" in the array to look.  Is this a 2D array with a time stamp attached?  How are you timing your acquisitions?  It would be helpful if you could post your VI.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 2 of 8
(2,547 Views)

Hello Reese,

 

thank you for your time to read my message!  I found an alternative way to solve my problem.  Using shift registers worked for me in this particular applicaiton.

 

Best,

Nestor

0 Kudos
Message 3 of 8
(2,518 Views)

Glad to hear it.  If you could post a .png or your VI and mark as the solution, it could help others with similar issues.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 4 of 8
(2,506 Views)

Hello Nester,

 

Now I am facing the same issue with yours, I want to do a comparision in an array... how did you manage to solve this using shift rigisters? I  would really appreciate your help. if possible, could you please post a picture? Thank you.

0 Kudos
Message 5 of 8
(2,451 Views)

@Nestor C wrote:

Hello,

 

I am correctly acquiring data and placing them continuously into an array.  I want to look at the last 5 seconds of data whenever I push a button, in other words pushing the button would work as a time marker to tell labview to look 5 seconds back.  If the values of data contained within the last 5 seconds are all greater than 1, a LED would light on.  If the values of data contained within the last 5 seconds are between -1 and 1 another LED would light on, and finally if the values of data contained within the last 5 seconds are all less than -1, another LED would light on.  Is there a simple way of doing this?  I will appreciate your suggestions, thanks!

 

Best, 

Nestor


Try using a 5-seconds worth of data Circular Buffer. Anytime you flatten the buffer, there's your previous 5 seconds of data in a waveform or array.

 

Check out this implementation

https://decibel.ni.com/content/docs/DOC-20403

 

If you are having a DAQ buffer larger than 5 seconds, you can perhaps calculate how far back in the buffer you have to point to get the last 5s of samples:

 

DaqBuffer.JPG

 

Br,

 

/Roger

0 Kudos
Message 6 of 8
(2,446 Views)

presumably you are sampling at a fixed rate. Another option is too use queues of a fixed size (say 5 secs worth of data but you would have to work out how many elements that is) as your program is running use lossy enqueue so this will keep the previous 5s worth of data. When you push the button set whatever leds etc you need to and process the data by dequeueing until the queue is empty.

 

hope it helps

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 7 of 8
(2,440 Views)

presumably you are sampling at a fixed rate. Another option is too use queues of a fixed size (say 5 secs worth of data but you would have to work out how many elements that is) as your program is running use lossy enqueue so this will keep the previous 5s worth of data. When you push the button set whatever leds etc you need to and process the data by dequeueing until the queue is empty.

 

hope it helps

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 8 of 8
(2,439 Views)