Hi.
I am a new LabJack user and I am using U6. I am using C# and currently I am trying to understand the stream function. What I ultimately want to do is to get electrical impedance fluctuation with plotted against time using conductivity probe(s).
So I hope to get some clarifications about the stream mode:
1. Buffer size
//Give the UD driver a 5 second buffer (scanRate * 2 channels * 5 seconds).
AddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chSTREAM_BUFFER_SIZE, scanRate*2*5, 0, 0);
So when I set a 5 second buffer size, how does it work when the max sample number of the U6 driver is 984 samples? Or are we talking about different buffers here?
2. Wait mode LJ_swNONE
In this mode using C#, there is a delay before eGet, so this delay is to wait for data to be obtained by the UD driver before it is transferred to the software (does the term "host" in the U6 Datasheet refers to the software?) right?
Thank you for your help.
1. There are two buffers. There is the software buffer in the UD driver which is configurable with a call like your AddRequest, and there is the hardware buffer on the U6 which is limited in size in comparison with 984 samples. In stream mode the U6 hardware samples and buffers data (984 samples max.) at the configured scan rate, and the UD driver reads from the U6 hardware stream buffer and adds that data to its software buffer which you read from.
2. That delay is there so the application can wait for the requested amount of samples to be available in the UD stream buffer. For example, if the scan rate is 1 kHz and you want to read 500 scans, 500 scans will be available every 500 milliseconds (#Scans/ScanRate). Alternative to LJswNONE, LJ_swSLEEP is common to use. Streaming using the UD driver is documented here:
https://labjack.com/support/datasheets/u6/high-level-driver/example-pseu...
Regarding the "host", you are mentioning the documentation here, correct?
https://labjack.com/support/datasheets/u6/operation/stream-mode
That is the hardware documentation on stream mode. The host it mentions the host application, which requests/sends USB packets over the USB host.
Hi.
Thank you for your quick reply.
So I wrote a console application using the LJ_swSLEEP and the sampling rate is 2000 samples per second.
Once I start the application, my UD Backlog fluctuates from 0 to 25 to 50 and then back to 0 for each iteration. In this case, the backlog data is transferred to my application with the correct time stamp sequence right? I mean although the data transfer is a bit delayed from the driver to the application, still it is in its intended sequence right?
Can I say that as long as the UD Backlog value does not grow larger and larger, the data that I am taking is fine?
Thank you.
Yes, the UD backlogged samples are in the correct timed order. What you are seeing with its values (0 -> 25 -> 50 -> 0) is fine as it is decreasing back down to 0. As you mentioned, as long as the backlog is not continuously increasing (growing larger and larger) you are fine.
When the UD backlog value is continuously increasing, that indicates a UD stream buffer overflow will eventually occur. This is caused by the application not being able to read the samples from the UD stream buffer at a fast enough rate to keep up with the U6's scan rate.