12-15-2015 04:44 AM
Hi,
I am quite new to LabVIEW, I've only been learning for a few months. I'm using LV 15. I've been searching for answers on the forums, up til now I've found what I needed but I'm afraid I need help.
I'm writing a program to analyse tdms files. They contain data relating to 32 thermocouples. There are 5 water tanks, each have 6 tcs in them, labelled A-F and with their numbers i.e. A1-F1 for pool 1. The final two tcs are the ambient temp. and the ground temp. There are sheets corresponding to pools then within the sheets the column headers correspond to the correct sensors.
One feature I've tried to add into my program is to display the temp diff between any two tcs the user chooses on a waveform graph. To do this I use a combobox which has a menu to select the pool number (or the environment for the final two tcs). Then, as I'm using a case structure, depending on the pool you select only that pool's tcs are shown in a second combobox (i.e. if you select Pool 1 sensors A1-F1 are shown next). This saves having a dropdown menu of 32 tcs and saves reading in invalid tdms channels (A2 wouldn't work if the input group is pool 1). I have another two identical comboboxes as the sensor which is being subtracted.
For the two case structures I have made sub vis, and I'm using them in an event structure so whenever the value of either the pool selector or the tc selector changes it reruns the subvis.
I can change from pool 1 - pool 2 (or any other pool) just fine, the channel in changes to a blank string and using a probe I found it actually inputs "Time" - the first column in each tdms sheet which I ignore in my analysis (I already have a timestamp and an interval). Then I do the tc selection, eg A2, and it works fine again. The problem arises when going BACK to Pool 1, there is an error which says invalid channel or group. I know that the group is fine - I'm changing this and I checked with probes. The issue comes with the channel, it simply inputs nothing. I'd expect it to just replot the time, but it hasn't, maybe this is a feature of tdms that I am not aware of, but it doesn't plot anything.
All that happens is I have to click stop or continue then select the tc if I choose to continue, but I want it to be seamless and I'm afraid I'm stumped.
I appreciate any help anyone can offer, if you need it I can zip up the files and attach them, if you are using an older LV let me know.
Thanks,
Joe
12-15-2015 04:50 AM
12-15-2015 05:17 AM
Hi GerdW,
Sorry, I'm not sure what I expected.
Here is the project with VIs, I hope saving to LV14 has worked. I've only partly documented I'm afraid. The top graph works just fine, any change will update the display without a stop/start. The bottom graph has the trouble. I've included a very small TDMS file. If you open this file then run you can see the issue. Try starting at Pool 1 A1 and change to Pool 2, sensor selector A should go blank, then select any sensor. After that, change back to Pool 1 and it should break.
As I said, I'm new to LV and there's probably a much more...elegant way of doing this. If you can provide any more pointers that would be great.
Thanks,
Joe
12-15-2015 06:24 AM
Hi Joe,
Try starting at Pool 1 A1 and change to Pool 2, sensor selector A should go blank, then select any sensor.
That works fine.
After that, change back to Pool 1 and it should break.
It "breaks" as the "Sensor Selector A" goes blank: there is no channel with a blank name in the TDMS file…
And it "breaks" because you didn't check any errors occuring in your VI!
You need to work on the logic/algorithm for selecting data in the TDMS file.
Using 2 rings to select a single signal seems "complicated" to me. I would use a listbox or a tree control…
- In the "Pool Selector A/B" VIs you don't need to create a new tunnel for the Combobox reference in each case, use just one common tunnel.
- Having several cases in these subVIs doing merely the same is kind of RubeGoldberg: in the cases you only need to do the things, which are different - the remaining stuff belongs once outside the case structure!
- You should always wire the error IO!
- When you wire the datatype input at TDMSGetProperties you don't need an additional ConvertFromVariant afterwards…
12-15-2015 06:49 AM
Hi GerdW,
When I made the current setup using two comboboxes I was hoping it would be able to repeat. For instance, the first run from Pool 1 - 2 works fine, with Sensor Selector A being blank (but reading in "Time" when checking a probe). I was sort of hoping that by changing the default to "Time" (although as I said I'm not interested in time) every run would be able to reinitialise to Time and then it would work fine, but after trying this it still hasn't worked...can a "channel(s) in"section on a TDMS read function re-read the same input without error or am I missing something?
I'll take a look at listboxes and tree controls, this is something I haven't worked with yet, so thanks for the suggestions!
I did notice that the multiple tunnels looked cumbersome, but when I took the case selector and made a sub VI that's how it was wired so I didn't change it, but thanks that will tidy it up a lot.
I'll switch up the sub VIs so that more things execute outside of the case structure. I'll wire up the error IO...
Thanks for your help!
Joe