Obtaining the Total Test Duration From FlexLogger Log Files

Updated Aug 30, 2023

Environment

Software

  • FlexLogger
  • LabVIEW

This article demonstrates how the total duration of a test in FlexLogger™ can be extracted from the TDMS log file. The timing of the test begins at the point of pressing the Run button and ends when the Stop button is pressed.

The test duration cannot be logged to the TDMS as an additional property from FlexLogger. This is because each logged sample is automatically associated with a timestamp and hence, the total test duration is already implicitly a part of the TDMS file. Instead, this article indicates how the timestamp data can be manipulated in LabVIEW™ to obtain the overall test duration.

After generating a TDMS log file, create the following VI in LabVIEW:
 
  1. In a new VI, place a TDMS Open Function from the File I/O >> TDMS Streaming palette.
    • Specify the Operation (0: open) input as Open.
    • Specify the File Path input as the location of your saved TDMS log file.
  2. Place a TDMS Read Function and connect the TDMS File Out and Error Out wires from TDMS Open to it's relative inputs.
    • Create a string constant containing the channel group name of interest and connect this to the Group Name In input.
  3. Place a For Loop and connect the Data output from TDMS Read to it's input.
  4. Inside the For Loop, place a Waveform Duration VI from the Waveform palette.
    • Connect the Indexed Data tunnel to the Waveform In input.
    • Connect the Error Out wire from TDMS Read to the Error In input.
  5. Add an Insert Into Array Function to the For Loop.
    • Connect the Duration output from Waveform Duration VI to the N or N-1 Dim Array input.
    • Wire the Output Array to the output of the For Loop, ensuring that the tunnel is replaced with a Shift Register. Place the other end of the Shift Register on the input of the For Loop. Refer to Using Shift Registers in LabVIEW for instructions.
    • Place an array of doubles outside the For Loop and connect it to the input Shift Register
    • Place an Indicator on the output Shift Register.
  6. Place a TDMS Close Function after the For Loop.
    • Connect the TDMS File Out from TDMS Read to the TDMS File input.
    • Connect the Error Out from TDMS Read to Error In.

The VI should now appear similar to the following:
Get Waveform Duration.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

After running the VI, the Duration(s) array in the example Snippet will populate with the test duration for each individual channel. To obtain the total test duration independent of individual channels, use an Array Max & Min Function to isolate the largest element inside the Duration(s) array. This element represents the overall duration of the test.