Other Considerations for Reading and Writing Waveforms in a Custom Device Engine
- Updated2025-10-27
- 2 minute(s) read
Other Considerations for Reading and Writing Waveforms in a Custom Device Engine
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.
Avoiding Data Loss When Reading and Writing Data
- Write sessions—The queue size is three elements, so the custom device can write three times without the WPL reading from the queue before data loss occurs.
- Read sessions—The queue size is three times the number of waveforms being read. For example, if you read from ten waveforms, the queue size is 30.
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.
Identifying the Source of Values When You Read from Multiple Waveforms
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.
Calculating the Start Time of a Read Operation
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.