When reading and writing waveforms in a custom device, you should try to avoid data loss, identify the value source when reading from multiple waveforms, and calculate the start time of a read operation.
If you notice data loss, you can specify a larger, custom queue size for the VeriStand Engine to use. When you open a read or write session with the Open Waveform Session VI, use the elements of the Communication Properties input cluster to define a custom queue size. If the CPU cannot read or write as quickly as the custom device requires, changing the queue size will not resolve data loss, only delay it.
For read sessions, you can monitor the WPL Overflow Count system channel to determine if a queue overflows. For write sessions, use the timed out? output of the Write Waveform(s) VI to indicate when data loss occurs.
If you open a read session for multiple waveforms, the Read Waveform(s) VI executes whenever any waveform returns data, and the VI returns data from only that waveform. You can identify which waveform the data came from during a particular execution using the Data reference element that the VI returns in a cluster output called Properties. Compare the Data reference to the data references you generated before you opened the waveform session.
When you read from a waveform with the Read Waveform(s) VI, the VI returns a cluster that includes a t0 at start element. t0 at start is the start time of the first sample in the waveform, not the start time of the first sample in the current array of read values. You can calculate the start time of the first sample read during a particular read operation using the following equation:
current t0 = t0 at start + (dt * offset from start (samples)) where t0 at start is the start time of the first sample in the waveform, dt is the time between samples, and offset from start (samples) is the number of samples by which the first sample in the array of read values is offset from the first sample in the waveform.