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.
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.
03-25-2019 02:40 PM - edited 03-25-2019 02:41 PM
Continuing... I found that if I add Waveform Duration and waveform "Final Time" I get closer to real time playback.
But 2 minutes of waveform capture plays back in 1:55
I don't understand why real time playback is so difficult. I must be going about it completely wrong?
03-25-2019 02:47 PM
Sounds like your file I/O is slow.
Consider using a producer consumer with a fixed size queue between them.
Let the Producer spin as fast as it can and wait when the queue us full.
In the consumer pull the records from the queue one at a time (like you are trying to do in your attached image) and pace the chart updates on the duration.
Quoting an old associate:
"Queues are almost always nearly full or nearly empty."
Using the above approach your queue should always be almost empty until you run out of data.
Ben
03-25-2019 02:51 PM
@RTSLVU wrote:
Continuing... I found that if I add Waveform Duration and waveform "Final Time" I get closer to real time playback.
But 2 minutes of waveform capture plays back in 1:55
I don't understand why real time playback is so difficult. I must be going about it completely wrong?
File I/O requires the OS to get the data from disk, and sooner or latter your process going into a resource wait state between when you ask for the data and it shows up. There is also going to be seek latency as the disk gathers the data from the scattered sectors on the disk. When writing using TDMS, the data does not go directly to the disk but rather into a memory buffer that is when possible written to disk.
Ben
03-25-2019 05:29 PM
Do you have a small # samples per waveform record, like maybe around 5?
In addition to Ben's suggestion to use a queue to separate file access from gui updates & timing control, I'm wondering if your use of the "waveform duration" function might be leading you to an off-by-1 problem.
By default, the duration function gives you an "open interval" time rather than a "closed interval" time. When you have N samples in a waveform record, an "open interval" will return (N-1)*dt while a "closed interval" will return N*dt.
Your original attempt ran in 4/5 of the expected time, which is exactly what you might expect with 5 samples per waveform record while using the "open interval" version of duration. You should plot the first N samples then wait for N samples worth of time by specifying a "closed interval".
Note: adding duration to "final time" should not be meaningful nor should it be pursued.
-Kevin P
03-25-2019 05:34 PM
If you take a look at the "get waveform components" you will see it returns T0 (start time), delta T (time delay between points), attributes and Y array.
When playing back the T0 and attributes are unimportant, but you want to output each element from the Y array, delaying by delta T each time.
0xDEAD
03-26-2019 09:19 AM
@deceased wrote:
If you take a look at the "get waveform components" you will see it returns T0 (start time), delta T (time delay between points), attributes and Y array.
When playing back the T0 and attributes are unimportant, but you want to output each element from the Y array, delaying by delta T each time.
0xDEAD
That didn't seem to work 2 minutes of waveform capture played back in 10 seconds.
Waveform playback from a file is too fast is the issue I am having
03-26-2019 09:29 AM - edited 03-26-2019 09:36 AM
@Kevin_Price wrote:
Do you have a small # samples per waveform record, like maybe around 5?
In addition to Ben's suggestion to use a queue to separate file access from gui updates & timing control, I'm wondering if your use of the "waveform duration" function might be leading you to an off-by-1 problem.
By default, the duration function gives you an "open interval" time rather than a "closed interval" time. When you have N samples in a waveform record, an "open interval" will return (N-1)*dt while a "closed interval" will return N*dt.
Your original attempt ran in 4/5 of the expected time, which is exactly what you might expect with 5 samples per waveform record while using the "open interval" version of duration. You should plot the first N samples then wait for N samples worth of time by specifying a "closed interval".
Note: adding duration to "final time" should not be meaningful nor should it be pursued.
-Kevin P
The waveform are being captured using NI-Scope and a NI USB-5132.
The most common scope setting is:
I am basically dumping every sweep into a queue then saving to waveform file.
So I obviously do not understand understand the file format. Because shouldn't there be a "record" for each "sweep"? There does not seem to be nearly enough records.
03-26-2019 09:54 AM
Is your "duration" indicator showing values that you would expect?
Ben
03-26-2019 09:55 AM
@Ben wrote:
Is your "duration" indicator showing values that you would expect?
Ben
What duration indicator?
03-26-2019 10:07 AM
@RTSLVU wrote:
@Ben wrote:
Is your "duration" indicator showing values that you would expect?
Ben
What duration indicator?
The one on your front panel that is controls the wait.
Ben