06-11-2012 09:41 AM
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.
06-11-2012 09:55 AM
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.
06-11-2012 10:53 AM
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,
06-11-2012 11:05 AM
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.