From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding virtual/physical CJC channel to existing task

Solved!
Go to solution

Hello

 

I have a NI 9211 TC modules that I am using to acquire temperatures through LabVIEW 2013 SP1, I have an existing task that was created in MAX.  I want to monitor the built-in CJC temperature sensor as well.  After looking at several posts, I discovered how to assign the hidden physical channel to a virtual channel in LabVIEW and then display the CJC value.  BTW...  No where is there good documentaiton that shows how to do that for the cDAQ series... finding the "AI Temp Built In Sensor" is not clear (you have to look under "Analog Input, More").  But that part works now.

 

--> I would like to add this CJC channel to my existing task, but I get an error.  See CJC1.vi

Or, as an alternative, I would like to acquire the CJC temperature and acquire the other 8 channels' temperatures and then somehow combine them for display, logging, etc.

Note: I would like to keep the data in waveform format so they work as part of a larger data acquistion program I already have.  And I want to keep using the existing task since it contains the calibrations (through the MAX Calibration Wizard).

 

Here is the error that occurs when I run CJC2.vi with the disabled code block enabled.  (sometimes only shows up after Stop button is pressed)

Error -200072 occurred at DAQmx Create Channel (AI-Temperature-Built-in Sensor).vi:7050002

Possible reason(s):

Duplicate channels in the list of physical channels are not supported by this device.

Channel Name: _cDAQ3Mod1/_cjtemp
Duplicate Channel: cDAQ3Mod1/_cjtemp
Physical Channel: _cjtemp
Device: cDAQ3Mod1

Task Name: DAQ3 Task

 

Attached files:

CJC1.vi <-- shows combined code and it throws the error.

CJC2.vi <-- shows how I acquire and display data from 8-channel task

CJC3.vi <-- shows how the CJC temperature works by itself

Now, how do I combine the two?

 

Thanks for the assistance,

Derek

Download All
0 Kudos
Message 1 of 10
(6,034 Views)

Hi DerekK,

It looks like there might be an issue with the task you are trying to add the CJC channel to. That error usually means a channel is already being used by a task and cannot be claimed a second time, as per this KnowledgeBase article.

I played around with your code some, and it looks like having both the CJC and all four Thermocouple channels on the task at the same time is possible for the NI 9211, so you may want to check your configuration of "DAQ3 Task." Also try the below code snippet (which is just your code modified so that the task is created in LabVIEW rather than only attaching the CJC channel in LabVIEW). If you're still having problems, please give us some more information on how exactly "DAQ3 Task" is configured on your system, as the error appears to be caused by a disagreement between its configuration and your LabVIEW code.

CJC.png

Charlie J.
National Instruments
Message 2 of 10
(6,012 Views)

Hi Charlie

Thanks for getting back to me.

I created code from your snippet (see CJC 5.vi attached).  It runs and shows the 7 of 8 TCs and the CJ temperature ok, but there is an issue with channel DAQ3Mod1/ai0 - it is reading ~500 (not ~23°C like the other channels).   See Capture CJC 5.png attached.  The channels look ok when I run CJC 2.vi (uses the original MAX task).  I am not sure if this is an unrelated issue or not.

 

I use NI MAX v14.0.1.  I attached the .nce config file so you can see how my task was created.  I don't see anything wrong with it.  (To get it to upload, I had to rename it to .ddd - change back to .nce)

The KB article explains that I can't create a physical channel in LabVIEW with the same name as one in MAX.  So there is always a physical channel called _cjtemp when you create a task in MAX.  So how do I access it in LabVIEW if it isn't part of the MAX task and you can't add it to the task in LabVIEW as a virtual channel?

a) can I rename or copy it to unique virtual channel name somehow?

b) how could I acquire the CJtemp value in one DAQmx block and then acquire the other channels in another block, and then join then together into a single waveform?

 

Also, please recall that I would I really would like to create the task in MAX and use it in LabVIEW so I can calibrate the TCs using the MAX Calibration Wizard.  Creating the task in LabVIEW would not allow this, I believe.

 

Also, can you tell me what the time constant of the CJC control is for the NI 9211 and 9213 modules?  It appears to be very slow (damped response).

 

Thanks, Derek

Download All
0 Kudos
Message 3 of 10
(5,970 Views)

Hi DerekK,

After some research, it looks like the cjtemp reading may need to share resources with one of the actual thermocouple channels in order to read it. Out of curiousity, if you switch the cjtemp from the first 9211 module to the second 9211 module, does channel ai0 on that module display similar behavior? If so, it looks like that internal channel is using some of the same resources as that thermocouple channel, and would explain why you were seeing the error when you tried to add the cjtemp internal channel to your pre-existing DAQ Task. I did try having the cold junction value and the thermocouple channels running in different tasks, but this is not possible and you would get an error stating that the device resources are already in use. 

There is not a way to add internal channels to tasks in NI MAX, but the internal cold junction should not be calibrated anyways so I don't think that is normally an issue. Is there a specific reason you need to display the cold junction temperature?

Regarding the time constant for the CJC control, have you checked the device specifications or manuals? If the value is not given in there, it may not be something we have access to.


Charlie J.
National Instruments
0 Kudos
Message 4 of 10
(5,937 Views)

Hi Charlie
Reading Mod2_cjtemp caused Mod2/ai1 to go bad. (which is weird - on Mod1 it affected ch0, on Mod2 it affected ch1).  See attached screenshot.

 

The purpose of this is to verify that the instrumentation setup in our lab is working well. One item I want to verify is that our 9213/9211 modules are not being affected by changes in ambient temperature. So I wanted to log the CJ temps along with the TCs and see if actual changes in ambient temp (adjacent thermal chambers cycle on and off and put out a lot of heat) are being compensated for correctly. I have read all the documentation and best practices for minimizing thermal gradients across the module terminals so the CJC is optimal.

 

The time constant of the CJ compensation is not in the manuals or specs for the 9213 or 9211.

 

I tried a new approach... create a task in LabView for the CJtemp and read the data, also take the MAX task and read it, and then merge the data for display and logging.  But this didn't work - gave an error because the task was already in use.  See CJC 6.vi attached.

 

Let me know if you have any other ideas...  it seems that this is a bug or oversight in functionality...  You can't use internal channels with other regular channels.  OR if it is possible, what is the NI recommended method?

 

I would like this to work as I hoped, but in the meantime I think I will just create task from individual channels in LabVIEW (skipping the nice calibrated task that I had from MAX) and include the CJ temp.  Then whichever signals come through I will use to verify that the ambient temperature changes are not affecting the measurement accuracy.

 

- Derek

Download All
0 Kudos
Message 5 of 10
(5,903 Views)

Hi DerekK,

It turns out that specific internal channel needs to read differently from normal. When you make the task in NI MAX, you are using the Built-In CJC option, correct? The reason we could add that channel in LabVIEW was that we hadn't set the Thermocouple task to use the Built-In CJC. The error from before was because the CJC was already being read by the device, even though it was not outputting it directly, as it was using it for CJC. You can configure the same in LabVIEW by wiring the correct value to the "CJC Source" terminal on your DAQmx Create Virtual Channel when it is set to read thermocouples.

According to the following KnowledgeBase article, you should be able to read that value by using a Channel Property Node. You will still need to use LabVIEW (though C or C# would work as well) as Internal Channels cannot be added to a task in NI MAX. 
http://digital.ni.com/public.nsf/allkb/FFAEB301361522D9862572CA00196D7B

I currently don't have the hardware to test this out on, so let me know if it works for you! I will say that using that Channel Property Node might end up with the CJC channels from both NI 9211s being displayed, though again I can't test this without the hardware. 

Charlie J.
National Instruments
0 Kudos
Message 6 of 10
(5,878 Views)
Solution
Accepted by topic author DerekK

The KnowledgeBase appears to be a bit confusing right now because it only shows the property node for Force Read From Channel. This is the correct property needed to read from a CJC channel while it is being used, but you also have to set the CJC channel as an active channel first. The following code snippet is the correct way to do this in the context of this thread. 

Please note that you must be using the built-in CJC source for this to be applicable. 

CJC Force Read.png

Charlie J.
National Instruments
Message 7 of 10
(5,840 Views)

Hi Charlie

Yes I am using built-in CJC option... added that to the Create Virtual Channel.  I added the property node and set it to true.

 

See attached "CJC 5 v2"
I still can't get it to work when the Enable CJC structure is enabled.  I get the same 200072 error as before.  Is there a problem with the way I am adding additional channels to the task created in the first block?

 

Can you or one of your NI colleagues please try this out on actual hardware?  I have a subscription for LabVIEW support and need a tested solution that I can then use.

 

Thank you,

Derek

0 Kudos
Message 8 of 10
(5,838 Views)

Hi DerekK,

Have you tried the code snippet I posted above exactly as it appears? I used your same task and device names, so it should run on your setup. You do not need to add the cjtemp channel with a "DAQmx Create Virtual Channel" as it is already included in the task when you set the module to use the built-in CJC, hence the reason it has to be read using Force Read.

Charlie J.
National Instruments
0 Kudos
Message 9 of 10
(5,836 Views)

Hi Charlie

Yes that works.  Our most recent posts got crossed in transit.

I agree the Knowledge base is not really clear that you have to set the other property too.  Can that knowledge base get updated.

 

Thanks, Derek

0 Kudos
Message 10 of 10
(5,826 Views)