From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data logging in state machine

I have created a State Machine that runs a sequence of steps require to test a motor. The steps are as follows:

 

Initialize > Sets the various relays and control selected by the operator.

HI-POT > Runs a Hi-Pot Tester via USB to RS-232 and returns (Voltage and Leakage Current Values)(all dbl's)

Run-Motor > This State activates various relays to apply power to the unit under test.

Power > This State will eventually take readings from a power meter via USB to RS-232 and return (Power, Current 1, Current 2 and Current 3.) (all dbl's)

Rotation > This State checks the rotation of the unit and returns a data string (CW or CCW)

Analyze > This State will compare the various reading to the expected reading entered by the operator and display visual indicators for readings out of parameters.

Stop> This State disables power to the motor under test and awaits the operator to re-initialize or start new test.

 

My question is what is the best way to log the data from the three different states into a TDMS file? In the future I may need to add the ability add a serial number via 2-D barcode scanner. I thought about using Local Variables but have read that it was not a good idea.

 

Thanks for your help.

 

 

0 Kudos
Message 1 of 4
(2,521 Views)

Just put the TDMS open in your initialization state and wire the reference to a shift register. In each of your states where you want to write data you will have the reference available. Or maybe I am missing something.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 4
(2,514 Views)

OK, this looks like it will work, but how can I have the vi create a TDMS file so the operator does not have to when starting a new batch of tests?

 

Thanks,

0 Kudos
Message 3 of 4
(2,502 Views)

You could create another state that closes the TDMS file and opens a new one. Either prompt for the new filename or automatically create one using a timestamp for the name. Wire the new reference to the shift register.

 

I have not really used TDMS (I should) but I think you can just use the same file for different test runs. Add a new property for the different test runs which would serve the same purpose as a new file. That way you could let TDMS do it's "Management" for you in a single file instead of you having to manage a bunch of files. I think that is part of it's purpose.

=====================
LabVIEW 2012


0 Kudos
Message 4 of 4
(2,495 Views)