LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start and stop writing TDMS files using a boolean toggle switch

I am trying to write tdms files using a toggle switch I named 'Start Test' in the attached VI.  I have figured out how to increment files so I don't overwrite the files, but I want to be able to create a new file each time I stop and start the 'Start Test' that I currently have tied to a 'Test In Progress' boolean indicator.

I'm very new to labview so it has been pretty frustrating trying to learn everything in such a short amount of time so I'm hoping someone might have some suggestions of what I'm doing wrong.

Also I need to have the data and time in there I just hadn't gotten it in there yet.  Is it possible to have the date and time write to every data point being output by the strain gauge data in the attached VI?

Download All
0 Kudos
Message 1 of 9
(4,098 Views)

Hi Michael,

 

I suggest something like this:

check.png

I added the Pt-by-Pt Boolean Crossing function to detect a "switching ON" condition and change the file creation mode of TDMSFileOpen…

There is no timing in your filewrite-loop so your TDMS file will grow very fast very big!

 

On your "timestamp" problem: you might add another channel in your TDMS file and writing the current timestamp in there…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(4,066 Views)

GerdW thank you for your suggestions, but when I tried to implement it nothing changed.  When I turn the 'Start Test' switch to on the file starts writing, but I'm unable to get the 'Test In Progress' to go to a false state when toggling the 'Start Test' to off so it still only writes one file. 

 

Also, I added  a Get Date/Time in Seconds, but it only writes it once. Is there a way to make it write for each data point the strain gauge data writes? I've attached my changes.

Download All
0 Kudos
Message 3 of 9
(4,052 Views)

Hi Michael,

 

- you didn't change the file open mode as I did in my suggestion, so your data file will get overwritten…

- your loop stops as soon as you start the file write…

- why don't you clean up your VI so one can see which wire belong to which tunnel?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(4,049 Views)

GerdW,

 

-I changed my open mode to 'open or create' as you pointed out. (I haven't been able to get the code to work enough to see that wouldn't have worked)

- When I turn on the 'Start Test' button the 'Test In Progress' indicator illuminates and turning the 'Start Test' to off does not make the 'Test In Progress' go to a false state like it should so I'm unable to write more than one file.

 

Strain Gauge.PNG

0 Kudos
Message 5 of 9
(4,044 Views)

Hi Michael,

 

there is an OR just before the loop stop condition: you stop the loop when "Start Test" OR "Write Stop" are set to TRUE!

 

So how do you want to set "Test in progress"  to FALSE when the loop isn't running anymore?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(4,040 Views)

GerW,

 

Thank you for your help. I took out the OR and had only the Write Stop going to the loop condition and now the 'Start Test' button and 'Test In Progress' indicator are working the way I want them to and I'm able to write incremented files.  Here is what I have now:

Strain Gauge.PNG

Now I need to try to figure out how to tie my Date/Time, Test Event, and Event Description to write to every strain data point being output.  The examples I've found online talk about using the Get Waveform Components function to take the time out to use, but I'm unable to wire that function to the waveform graph for some reason.  Is there another way to do that?

0 Kudos
Message 7 of 9
(4,030 Views)

Hi Michael,

 

Now I need to try to figure out how to tie my Date/Time, Test Event, and Event Description to write to every strain data point being output.

I would handle the timestamp as additional channel in the TDMS file.

The other items (Test event, Event description) would I store as property of the group (using TDMS Set Property)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(4,025 Views)

I'm trying to write a program to record and save strain gauge data as well as time, event description, and event number for each data point of the strain gauge data.  I based my program off the example for the NI-9235 using the cRIO.  I'm running into a problem where I'm trying to save the data to a TDMS file, but I can't figure out how to get the time stamp and other control data to write to each data point of the strain gauge data.  Is this possible?  I have attached the project I'm working on.

0 Kudos
Message 9 of 9
(4,024 Views)