09-26-2017 11:43 AM
Hi,
Based on the following example from NI:
http://zone.ni.com/reference/en-XX/help/372846L-01/veristandmerge/streaming_wfms_lv/
I would like to stream multiple waveforms at the same time. I need to record simultaneously 5 of them. I added to the proposed VI from the link above an array with all the Waveform Paths I need.
So, how can I write in a single TDMS file all the signals?
Thank you
Solved! Go to Solution.
09-28-2017 08:14 AM
Here is a White Paper that discusses some of the data logging methods available in VeriStand:
Viewing Time Correlated NI VeriStand Data Logs
Perhaps using one of the methods listed in this White Paper will help?
09-28-2017 09:43 AM
Hi,
the thing is, I only want to modify an existing VI to incorporate that functionality. And it is written in the link I gave that it is possible:
So, I already created the different stream specifications but I don't know how to proceed with the Event Structure to record all the datas and how to access to those datas.
09-29-2017 07:39 AM
The event structure in the example you referenced will fire when any one of the waveforms is ready, so if you have multiple waveforms, you could have the event structure run more than once and build an array of all of the desired waveforms. Once you have all 5 of your waveforms in an array, you could write them to a single TDMS file using the standard TDMS Write function.
09-29-2017 10:18 AM
Okay, so when you write :
"you could have the event structure run more than once and build an array of all of the desired waveforms"
since all my signals are triggered at the same time, how can I run the event structure multiple times? Do I need to duplicate the Structure? Because I don't understand how I can build the array with all my 5 signals recorded.
Thank you for your time.
10-02-2017 10:00 AM
Hi Frank,
If you take a look at the example, you'll notice that the Event Structure is encased inside of a While Loop. Since the event structure fires each time a waveform is ready, each iteration of the While Loop will receive one waveform. From there, you can set up logic based off of the WaveformPath property of the WaveformStreamSpecification to write to specific channels inside of your TDMS file using TDMS Write.
However if you do choose to set up this architecture, make sure to only Stop the WaveformStreamSpecifications outside of the While Loop rather than inside the loop (which is what is shown in the example).
Although all your streams theoretically should fire at the same time, Event Structures have a queue built into the backend to allow you to catch all events in the order that they are received. Your loop will continue to run and process data as you receive it losslessly.
I hope this clarifies the Waveform Streaming API a little bit. Let us know if you have any further questions!
10-02-2017 03:30 PM
Hi,
Thanks for your help. I just need some clarifications on a few points:
Thank you very much
10-02-2017 05:17 PM
Right now, right after the event Structure, I read the data but it seems that I can only access the first waveform. So, I don't know if I am supposed to add a loop somewhere to collect the other waveforms..
10-02-2017 06:28 PM
So, I finally found a way to do it. My issue was the End Condition of the While loop.
10-03-2017 09:55 AM
Hi Frank,
Thanks for posting an update, and glad to hear you were able to get it working! Writing to the appropriate channel in TDMS Write is the most essential portion, and it looks like you hit that on the dot here.
One quick note of feedback on this code - I noticed that you have a separate "channel name" array of strings control which you use to index through and select which waveform to pass in. Personally I'd recommend some sort of string parsing from your initial Waveform Paths array of strings to ensure that you don't have to input the channel name in two separate locations.
Hope this helps!
Best,
Yiran Li