Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Create channels to log GPIB to tdms

Hi-

I have an application that is monitoring a GPIB device asynchronously.  I would like to parse the returned status from the GPIB device and create individual digital channels that are logged to a TDMS file.  I'm curious how i would define the virtual channel where i would be writing the data.  I'm familiar with DAQmx.Task.DIChannels.CreateObjRef.  Does the PhysicalName member have to be defined for the channel if I'm using this method?  If so, what would I use as the Physical name being that this is a GPIB device status that I'm interpreting and not discrete IO.   Not sure if there's a best practice for doing this and I didn't see any obvious references floating around the forum.

 

Thanks,

Ben 

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

Looking closer at the documentation i should probably be referring too CreateChannel method, but not sure whether I can reference the method when i don't have real ports defined.

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

Referring to a post in the forum here.  Do i have to create a Global Virtual Channel to use this method?  If that's the case then it wouldn't work for my solution since i don't have real hardware. 

 

https://forums.ni.com/t5/Measurement-Studio-for-NET/Adding-multiple-global-virtual-channels/m-p/2489...

 

What i'm trying to do is just add a few dummy channels to an already existing Task that has real AIChannels already logging data to a tdms file.  If i'm using the Task class does this block me from creating a dummy channel?  I hate to use the word virtual channel because this seems to get thrown around alot in the documentation.  I need a truly virtual channel that isn't linked to any physical IO.

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

You probably should try to write the TDMS file without using the DAQmx integrated functionality.

 

using NationalInstruments;
using NationalInstruments.Tdms;

 

var myTdmsFileOptions = new TdmsFileOptions { Access = TdmsFileAccess.ReadWrite };
var myTdmsFile = new TdmsFile(filePath + ".tdms", myTdmsFileOptions); // create the file object

var myTdmsGrp = myTdmsFile.AddChannelGroup("myTdmsGroup"); // create a group

var myTdmsCh = new TdmsChannel("myTdmsChannel", TdmsDataType.Double, "TestData", "<unit>"); // create a channel
myTdmsGrp.AddChannel(myTdmsCh); // add the channel to the group

...

If you have access to the file handle just add the group/channel without creating a new file.

Hope it helps

Christian

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