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.
02-20-2019 05:26 PM
So I have been tasked with taking a program I made using NI-Scope and a NI USB-5132 and making it so we can stream a waveform to disk at the same time it is being displayed (duration TBD).
Then using a seperate program we want to be able to playback that saved waveform, view, and analyze it just as if it were live data from the USB-5132.
I have the saving part figured out, but not the playback part and am looking for suggestions and examples.
So far I have just started playing with the read waveform vi and have this:
Solved! Go to Solution.
02-21-2019 07:48 AM
I've never used the Read Waveforms from File function, so I'm guessing somewhat here. Some curious things:
Bob Schor
02-21-2019 09:16 AM - edited 02-21-2019 09:20 AM
Yeah I just threw this together, the iteration terminal and decrement was added later when I was trying something, so I had already painted myself into a corner
There are two outputs First Waveform in Record and All Waveforms in Record.
I was guessing that First Waveform in Record would output whatever waveform the "offset(record)" input was set to, so I wired in the iteration counter expecting to see a waveform playback with each iteration showing the next record.
Apparently that is not the case...
I guess I am going to have to read out "All Waveforms in Record" and index each record to the display myself.
02-21-2019 09:43 AM
@RTSLVU wrote:
...
I guess I am going to have to read out "All Waveforms in Record" and index each record to the display myself.
Yes that will work provided you do the chart updates at the same rate it was collected.
In one project I had to do the same thing but in my case I wrote the waveforms as data log files. I pulled a new record at the rate the data was saved/displayed. The interesting twist on that project was they wanted to be able to back-up the plot like hitting the rewind on a video to run it in reverse. In that case I threw the entire set at the chart via the chart>>> history and repeated that in a loop but truncated the data by one record each time it iterated. It worked better than I had expected and once the user backed up as far as they wanted to back-up, I could then resume forward in time by posting the updates as they came in originally.
Ben
02-21-2019 10:19 AM - edited 02-21-2019 10:20 AM
Yeah the timing issue has been floating around in my head since I started, and to make matters worse I am also going to have to sync the waveform playback with a table of voltage, current, and power measurements taken at about 1 second intervals during the waveform capture.
Now I am thinking that maybe my VI works like I thought it should but just too fast?
02-21-2019 11:49 AM
@RTSLVU wrote:
Now I am thinking that maybe my VI works like I thought it should but just too fast?
Now that's a novel complaint! The little peephole into your code afforded by your Snippet doesn't show from whence cometh the data -- I'm assuming a DAQmx acquisition loop. You also mentioned a point every two seconds, which suggests a sampling rate of 0.5 Hz.
If I might make a suggestion, DAQ devices make excellent clocks (timing is important in these things, and they don't have Windows or Updates or Virus Scans running in the background). If you really need 0.5 Hz data, I'd suggest setting your DAQ Task to acquire 10 points at 5 Hz, which "blocks" for 2 seconds and then gives you 10 points that you can Average, increasing S/N by a factor of several, basically costing you nothing. You can easily embed this in a Producer/Consumer design to get the DAQ loop really isolated, leaving 99+% of the CPU for "everything else".
Bob Schor
02-21-2019 02:19 PM - edited 02-21-2019 02:21 PM
Well the waveform data was created using a NI USB-5132 USB oscilloscope. The USB-5132 is not programmed like a NI-DAQ device it uses NI-Scope. But in general I am saving every "sweep" to the waveform file.
Here's a screenshot, again I just kluged in the save to file part to get something to work with as I figured saving a waveform would be far easier than playing it back, and I was right...
What I am running into now is "Write Waveform to File" says it wrote 1000 records.
But when I read the file I reach the "End of File" at 140 records?
02-21-2019 02:37 PM
TDMS is written to a memory buffer and when it darn right feels like it, it will write the data.
I believe a TDMS flush will force writing the buffer to file.
Ben
02-21-2019 03:02 PM
Thank you all for the recommendations
Priorities have changed and I have to back burner this for a couple weeks.
Watch for this topic to rise from the grave. 😛
03-25-2019 01:23 PM
Okay I am back on the project for the time being.
Currently I have: