Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Get data from NI CompactRIO

We have developed C#/WPF application that gets thermocouple data from various hardware, creates charts/reports and manages various project related tasks. In the past we have communicated NI Compact FieldPoint devices by using OPC DA. I was very satisfied with cFP devices and its OPC DA support and easy configuration options. We did not need LabView at all. Now cFP is outdated and we still want to support NI devices.

 

1. What is your suggestion for cFP replacement? Is it CompactRIO?

2. What are the best options to get data by means of our own application? Can we still use OPC DA like cFP? Any SDK?

3. Is LabView license required? Do I need to install LabView?

 

Thank you in advance.

0 Kudos
Message 1 of 16
(5,184 Views)

Vahap, your choice of what is the best replacement for your cFP system depends on your needs.  Could you expand a bit more on the role of the cFP in the system currently?  It seems like it currently acting as a OPC DA client, collecting TC data and serving it to other OPC clients?  Were we doing any processing on the cFP?  I am also guessing our sample rate is quite slow given we are working with TCs.  How many TCs are we sampling with the cFP system?

 

Your choice of replacement may change depending on the above questions.  I think your main options are going to be a cDAQ with a built-in controller (http://www.ni.com/white-paper/14029/en/) or a cRIO.  For both of these, the programming involved in usually LabVIEW. 

 

However, DAQmx does have non-LabVIEW driver support (http://www.ni.com/tutorial/5409/en/ and http://nidaqmx-python.readthedocs.io/en/latest/).  It also seems like there is a way for DAQmx to publish to an OPC server directly (http://www.ni.com/tutorial/3742/en/#toc4), but I am not sure if this ability is available in the text-based support of DAQmx. 

Here's an except (from http://www.ni.com/white-paper/4679/en/) that explains how you are able to communicate to other OPC devices with FieldPoint devices and DAQmx:

I/O servers are plug-ins to the SVE with which programs can use the SVE to publish data. NI FieldPoint includes an I/O server that publishes data directly from FieldPoint banks to the SVE. Because the SVE is an OPC server, the combination of the SVE and the FieldPoint I/O server serves as an FP OPC server. The FieldPoint installer does not include the SVE; it would have to be installed by another sofware component such as LabVIEW.

NI-DAQmx also includes an I/O server that can publish NI-DAQmx global virtual channels automatically to the SVE. This I/O server replaces the Traditional DAQ OPC server and RDA. NI-DAQmx includes the SVE and can install it when LabVIEW is not installed.

 

For cRIO systems, I think this might be interesting for you, http://www.ni.com/tutorial/14625/en/ . The cRIO platform supports the shared variable engine which can serve data to the OPC server.  However, I am not sure if this is a feature supported in the "Getting Started with C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition" tutorial.

 

What else is in your system?  We might be able to think up other ideas if can have a more complete understanding of your system.

Clemens | Technical Support Engineer | National Instruments
0 Kudos
Message 2 of 16
(5,154 Views)

I wonder whether this problem has been solved? For NI PXI, it is possible to get datas with Visual Studio C#. But, I do not know it is possible to get datas from NI CompactRIO 9025 or 9035 with C# ??

0 Kudos
Message 3 of 16
(5,132 Views)

sefa54, you will have to explain a bit more about what you mean by 


@sefa54 wrote:

For NI PXI, it is possible to get datas with Visual Studio C#. But, I do not know it is possible to get datas from NI CompactRIO 9025 or 9035 with C# ??


How are you currently getting data from your PXI and how do you want to get data from a cRIO-9025 or a cRIO-9035.  I understand you want to use C#, but how do you expect the data to be served up?  Do you envision having a C# application running on the cRIO or a C# application on your PC that is collecting data from the cRIO?  It is difficult for us to give you a useful reply without knowing what you are trying to achieve.

Clemens | Technical Support Engineer | National Instruments
0 Kudos
Message 4 of 16
(5,104 Views)

As you know, it is possible to connect to NI CompactDAQ and modules on it with C# using National Instrument DAQmx frameworks in C#. There are examples for this job.

 

But I do not know whether it is possible to connect NI CompactRIO and modules on it. I did not find any framework that is relevant with CompactRIO on the internet for C#.

 

I just want to connect CompactRIO and modules from my PC with C# application and collect sensor datas.

 

That is the biggest question that I want to find out answer of

0 Kudos
Message 5 of 16
(5,091 Views)

Thank you very much for your interest Kemens. Some white goods testing samples from production is tested for temperature changes. Existing system uses cFP-1808. I had configured channels in Measurement & Automation Explorer (MAX). When I saved it was creating .iak file and I was able to access channels directly with an OPC DA client. I do not need to install LabView, so I do not need to purchase any extra license, installing and using MAX ws enough.

 

Now we need to extend testing environment and new hardware is required. cFP-1808 is discontinued because of that prices are high. Besides I do not want to buy a discontinued product for a new project. In testing environment we use T type Thermocouples. Measuring 12.345 °C with less than 0.2 °C measuring error is quite enough. We read value per second, sample rate is slow. For example I read 192 TC channels located in cFP-1808 by OPC DA in every 5 seconds.

 

For example if I buy NI-9213 C Series Temperature Input Module (http://www.ni.com/pdf/manuals/378021a_02.pdf), can I use MAX to configure channels and set OPC DA? Do I have to install/purchase LabView? How about similar NI-9214 card?

 

Sensitivity is what I need in NI TC cards but comminication is something I am not sure about. I need to use my own application for reading data. It uses OPC DA and I am quite satisfied with OPC performance. I can also use some .NET (C#) SDKs from NI to get values, but I am not sure if NI-9212 or 13 supports this, and if I can use OPC DA it would be the way I go.

 

What cards or approach you suggest?

0 Kudos
Message 6 of 16
(5,074 Views)

sefa54, what I need is the same thing, but in my situation I can choose cRIO or cDAQ and I would prefer OPC DA over SDK if possible. I have checked a little about DAQmx framework. I also wonder if it is possible this with cRIO, no solution yet. I am still searching, reading what Kemens mentioned in first post.

0 Kudos
Message 7 of 16
(5,070 Views)

sefa, the newly available 904x series of CompactRIOs allow you to use DAQmx driver as well as the usual LabVIEW FPGA and LabVIEW RT that you get with every CompactRIO (http://www.ni.com/white-paper/54330/en/).  So, this would be no different than the way you are doing it for your PXI system.  One thing to note is that there are limitations as to which c series modules can interface with the DAQmx driver.  Only the modules that are able to be used on a cDAQ can be controlled by the DAQmx driver (reference http://www.ni.com/product-documentation/8136/en/).

 

Is there a reason you sought out the CompactRIO instead of a CompactDAQ?  What type of sensor data are you collecting and what is the rate at which you are collecting?  It seems like you may have some modules already in mind, which ones are they?  Is there any processing or logic you are wanting to do on the CompactRIO?

Clemens | Technical Support Engineer | National Instruments
0 Kudos
Message 8 of 16
(5,057 Views)

vahap, thank you for providing more information.  I don't believe there is such option of configuring modules for OPC DA in NI MAX for the cRIO or cDAQ.  If there is, I have not seen it done yet. I think your better option is to go towards the DAQmx API, so either cDAQ or the cRIO-904x family (that has both cRIO and cDAQ capabilities).  I forgot to ask you how many TC you are reading from.  If it is not too many, you might also look into the NI USB-TC01 (http://sine.ni.com/psp/app/doc/p/id/psp-916/lang/en), which is direct USB connected to your PC.  You will still need DAQmx for the USB-TC01, but it could be cheaper and a smaller footprint if you do not have that many TC to read from.

Clemens | Technical Support Engineer | National Instruments
0 Kudos
Message 9 of 16
(5,055 Views)

Hi again,

 

The reason of usage of CompactRIO  is that we have multifunction test system. To use CompactDAQ instead of the CompactRIO may be possible, but we do not have enough time for this changing.

 

We use CompactRIO 9025. Also we may use CompactRIO 9073. 

For example we use NI 9213 Thermocouple Module to measure thermocouple sensors and NI 9205 AI Module to measure pressure sensors.

 

Since our project is large, I want to use LabVIEW for more important things. At the same time, I want to collect these sensor datas with C# WPF Application.

 

As I said there are examples for DAQmx. Using these examples I will try to connect NI PXI. But at the CompactRIO side, I have no idea.

 

This is really really important for me. But I do not know what to do

0 Kudos
Message 10 of 16
(5,042 Views)