LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to take data with a 5105 PXI scope and put it into a buffer of around 20 seconds.

 I want to take data continuously and when an event happens, stop the scope manually but have 20 seconds of data previously to the event. 
I am having a hard time figuring out the best way to start this out.  Also, I cannot find any information that describes when to use each of the
different types of waveform formats that can be put out by the niScope Fetch WDT vi.  Certainly there must be a document somewhere with
these recomendations.  Thanks!
0 Kudos
Message 1 of 8
(3,658 Views)
what rate are you acquiring data at?
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(3,648 Views)
It will be variable, but will usually be in the neighborhood of 1,000,000 Samples/sec.  Maybe higher.
0 Kudos
Message 3 of 8
(3,645 Views)
You should use a multithreaded aproach with one threal (loop dedicated to the daq).  Outside of the daq loop start your task and pre allocate an array to store 20 seconds of date (20*1MS)  this will be fine for >10MS acquisition rates but will baloon up for high acquisition rates.  I would use fetch and fetch the scope at 10Hz (Read 100K points) this reading of a constant amound will set the tempo for the loop.  After reading the loop write it to your preallocated momory array (replace the next 100K points)  Use a circular buffer technique so that the buffer will have the last 20 seconds of data always.  When a stop signal (from antother section of the program) acts like a trigger, you can stop the daq and look at the array which holds the last 20 seconds of acq.  There are many other ways to do this.  This technique will avoide buffer over runs and minimise memory requirements.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 8
(3,635 Views)
Thanks Paul.  Any known examples for a circular buffer?
0 Kudos
Message 5 of 8
(3,628 Views)

Circular buffer is a common efficient implementation of a data buffer. 

init - allocate array of size N set write index I to 0

to update data with new sub array of size M

if N-M is Greater than I-> Replace subset starting at I then update I=I+M % N where % is modulus operation

If N-M is Less than I relpace the subset of the new data from 0 to N-M at index I and then replace the rest starting at I=0.

This acts like a circular array where you do not have to change your memory allocation and works for valuse where the update array is less then the buffer size N.

You can also use queues and set a max queue size (= samples/20 seconds * number of reads/set) this is less efficient but easier to implement since it is already done.

 

Paul 

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 8
(3,621 Views)

Hi,

Depending on which memory option you have it may be possible to set up a single record acquisition and use 100% pretrigger samples such that your entire acquisition will consist of the samples acquired before the trigger is sent, using the formula:  [(Record length* × 2† × number of enabled channels) + 480‡] rounded up to nearest 128 bytes, which is found in the NI-5105 specifications document page 15/24. Using one channel you will need about 41Mb of on board memory to accommodate this. For more information on setting up this acquisition I suggest looking at this knowledgebase entry, as well as the examples which can be found at Start>> All Programs>> National Instruments>>NI-Scope>> Examples I suggest the niScope EX Configured Acquisition.vi which details the basic program flow for setting up a trigger. I hope this helps!!!

JaceD
Signal Sources Product Support Engineer
National Instruments
0 Kudos
Message 7 of 8
(3,611 Views)
Yes if you have enough onboard memory then use it I usually dont get the chance to have this luxury.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 8 of 8
(3,601 Views)