08-19-2019 08:54 PM
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
08-20-2019 02:57 PM - edited 08-20-2019 02:58 PM
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.
08-20-2019 08:36 PM
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.
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.
08-29-2019 04:30 AM
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