01-30-2021 09:37 AM
Hello everyone, just finished writing my first VI using an event state machine architecture. I have 4 while loops in my VI;
I'm using a channel stream writer to stream data from the DAQ read loop to the data logging and viz loops.
My question is regarding the timestamps of my save data in the TDMS file, the way I'm adding a timestamp is the following;
Is my logic of adding the timestamp okay? I don't think it is, because at 1 samples per channel the code runs slower than a timer. Is the way I have setup the loops okay? (I understand that a QMS or similar would more than likely be better). I have attached my VI, removed most of the sub-VIs to show how in principle it works.
02-14-2021 09:37 AM
Hi AdzyA,
I'm not familiar with channel wires so it is a bit difficult for me to follow the code. Would combining the two while loops that contain event structures into one and getting the information between the different events with a shift register work to simplify the architecture? That's how I would normally set up an event driven state machine.
On the timestamp, maybe I'm not understanding your question fully but when you record data in waveform format you don't record timestamps as such, you record t0 which is your starting point and dt which is the time step between data points and is defined by your data rate. If you have multiple channels you are acquiring from it will depend on whether the sampling rate you have defined is per channel or not, i.e whether dt corresponds to one data point or N data points where N is the number of channels you are collecting from. You can do a quick test at a low sampling rate to check what is being recorded into your TDMS file. The conversion from waveform to timestamp + data is straightforward, I've done it before but can't find the function I used - it would be very straightforward to add to a subVI using the d0 and dt values though. Hope this is relevant to your question!
Riley