Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

"The specified channel is already a member of a TDMS channel Group"

Solved!
Go to solution

Greetings,

I have an application where I am streaming data to TDMS.  I have set up a channel group and I am able to write to TDMS fine.  However, I need to code it so that when the datacount in the first tab (looking at first channel in the group) reaches x-amount, say 1,000,000, I need to dynamically create another tab (channel group) and continue streaming data.  The program should just continue to add tabs as they fill up with data.

 

Maybe there is a simple way to do this but I'm not finding it.  In short, I want to just take the channels in the first tab, "copy" them over to a new tab and continue streaming.  Through the TDMS methods, I am able to getchannels, getchannelgroups, etc. from the TDMS file.  But I cannot seem to add these channels to another channel group (new tab) or the program throws an exception error - "The specified channel is already a member of a TDMS channel group".  

 

The only work around to this, which I have not tried yet, is to make the channel names different on each iteration that I want to add a new channel group.  I anticipate that will be very cumbersome.  Is there a simpler way to make this work?  

0 Kudos
Message 1 of 4
(3,254 Views)

Hey bursarider29,

 

Unfortunately, I don't think there is a simpler way to make this work. Considering the architecture of TDMS files, I think the workaround you suggested seems the most reasonable. 

 

Cheers,

Saki K.
Applications Engineer
0 Kudos
Message 2 of 4
(3,212 Views)
Solution
Accepted by topic author busarider29

Remember TDMS is not an Excel file.  How it is viewed in Excel is based on a plugin created by NI.  Things like Tabs, Rows, and Columns don't exist in TDMS and only exist in Excel after it has been imported.  As a result you have very little control over how the file is going to be displayed since it is done using NI addon.

 

You can write your own TDMS to Excel converter that uses ActiveX and after it hits some row limit create a new workbook, but this will likely be much slower than NI's addon, and would be a bit of a pain to write.

 

If you can control how the file is made I suggest just writing the code you described that makes a new group after so many samples have been logged.  That being said splitting up data like that might make other TDMS viewers like DIadem and Scout.X not work as well since those viewers will see them as separate groups and not continuous data.

0 Kudos
Message 3 of 4
(3,208 Views)

Thanks to all for the feedback.

 

I'm still working on the code for this but it appears that re-naming the channels (appending "_x number" after each new channel) and then adding the new channel group to the existing file will work.  This has been somewhat painful because of the architecture of TDMS, but it "appears" I'll be able to make it work.  The plan is to keep the number of channel groups in each TDMS file down to 10 so that each file doesn't grow astronomically huge, then when the file reaches 10 groups, the program will create a new TDMS file and continue on.  

 

We don't have DIadem or Scout.X, but I did anticipate that any data viewer program would probably only be able to view and graph each individual group of data one at a time.  More than likely, I'll be writing a simple data viewer program at a later date to do that.

 

Thanks,

D

0 Kudos
Message 4 of 4
(3,201 Views)