LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced TDMS library Set Channel Info Error

I'm developing in Visual Studio 2010 Professional using the CVI libraries.  I'm attempting to use the advanced TDMS functions to write channel meta data separate from appending raw data to each channel by using TDMS_SetChannelInfo, but I receive the error code -6677 One or more of the specified channels is already present in the channel information.

 

I'm reading several hundred signals each of which is an object that carries several attributes (system the signal comes from, data_type, etc.)

 

My code arrangement is as follows:

 

TDMS_AdvancedCreateFile("./filename", TDMS_Streaming2_0, 0, "", "", "", "",&fileHandle, NULL)

 

I then step through all of the signals and create several channel groups based on each unique signal system.

 

TDMS_AddChannelGroup (fileHandle, signal_system_names.at(i).c_str(), "", &groupHandle.at(i));

 

I then step through all of the signals again and read each signals system and assign the channel (signal name) to the appropriate channel group (signal system).  I also assign each channels data type based on the signals data type attribute.  For use in the TDMS_SetChannelInfo and AdvancedSyncWrite functions, I create a vector of channel handles that correspond to a vector of channels with alike data type. e.g. I have a vector for all Float channel handles, all Int32 channel handles, etc.

 

TDMSchannelFlag = TDMS_AddChannel (groupHandle.at(i), TDMS_Float, my_it->second.GetSignalName().c_str(), "", "", &channel_handle);

analChanHandVec.push_back(channel_handle); //vector of analog value channel handles

 

At this point I should have a TDMS file with several groups containing numerous channels, each of which might have a different data type than the next.

 

I then attempt to set channel info for each vector of alike data types, where each call to TDMS_SetChannelInfo is for each vector (array) of alike data types.  So, &analChanHandVec[0] is a pointer to the first element in the vector of analog signal channel handles.  These data types are spread across several different channel groups though.

 

TDMSsetMetaFlag = TDMS_SetChannelInfo(&analChanHandVec[0],analChanHandVec.size(),1,TDMS_DataLayoutNonInterleaved);
TDMSsetMetaFlag    = TDMS_SetChannelInfo(&discreteChanHandVec[0],discreteChanHandVec.size(),1,TDMS_DataLayoutNonInterleaved);
TDMSsetMetaFlag    = TDMS_SetChannelInfo(&digChanHandVec[0],digChanHandVec.size(),1,TDMS_DataLayoutNonInterleaved);
TDMSsetMetaFlag = TDMS_SetChannelInfo(&undefinedChanHandVec[0],undefinedChanHandVec.size(),1,TDMS_DataLayoutNonInterleaved);

Upon the first call of TDMS_SetChannelInfo I get the error -6677 mentioned above.  If I am setting channel information before the call to this function I can't figure out where.  The TDMS_SetChannelInfo function requires the channels to be of the same data type, which they are, but does it require that the channels be within the same group?

 

The standard TDMS library works fine using this same scheme.

 

 

0 Kudos
Message 1 of 3
(4,320 Views)
Your use case seems to be creating multiple groups with different data types, and each group contains multiple channels of the same data type. I didn't find anything wrong from your description, so I write a CVI test program, and found the test program works well with no error during execution. It creates two groups, one for int32 data, another for double data, and each group has two channels under it. Please refer to the attachment to see if this satisfy your need.
0 Kudos
Message 2 of 3
(4,290 Views)
0 Kudos
Message 3 of 3
(4,287 Views)