Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Get data from NI CompactRIO

sefa, from what I am understanding you only have the cRIO-9025 and cRIO-9073 controllers available to you right now so you want to work with those pieces of hardware, correct?  What is your timeline on this project?

 

What is the separation between what your C# WPF Application is doing and what you are doing in LabVIEW?  If you could help me understand how you are splitting your system things would be a bit more clear. 

I am asking because to me, collecting sensor data with the C# WPF application seems to have a few interpretations and our options depend on:

  1. How much control does the C# application need to have over the sensor data? Does it need to control our sampling rate or any other sampling aspects?
  2. How quickly does the C# application need to receive the data? 
  3. Is the C# application a control application or a data analysis/visualization/data store-housing application?
  4. How are we currently using LabVIEW and how does LabVIEW fit in to your C# application and overall system?  Can we use LabVIEW to collect the data and then transfer it to your C# application?

The most direct way to interact with the hardware via your C# application is likely through the FPGA Interface C API. Here's a bit more description https://www.ni.com/docs/en-US/bundle/fpga-interface-c-api-ref/page/capi/overview.html If you use that method, you will need to though LabVIEW FPGA, which isn't bad, but it is more work than just using LabVIEW Real-Time and probably more than what your application needs in terms of performance.

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

Hi again sir,

 

Yes, we have just 9025 and 9073 series of CompactRIO. We will use one of these. Approximately in two mounths, I have to solve this problem.

Actually, there is no special reason to use C# WPF. I can do all of the work in LabVIEW. But we want to have experience on this job. 

The answers:

1- I should set sampling rate from C# WPF. 

2- My sampling rate will not be much than 100 ms.

3- The C# program will just be used to observe sensor datas at real-time. There will be no control or manipulation except setting sampling rate.

4- First I will look whether I can take datas from CompactRIO with C#. If I can, I will write a class program in C# instead of WPF, then I will embedded this class to the LabVIEW with .NET constructor node. 

 

( I tried this before with third-party device. I wrote C# class program and embedded it in LabVIEW. I just used constructor node and invoke node in LabVIEW. And I can observe the datas on front panel. )

 

If possible, I want to take datas using LabVIEW Real-Time. Because I have no experience at FPGA side. So I do not want to use LabVIEW FPGA. It is not necessary. Because we will sample at 100 ms rate.

 

Please for now just imagine that I just want to collect thermocouple sensor datas that are connected NI 9213 module on CompactRIO with C# WPF application at sampling rate 100 ms. Because if I could do this, it is enough for me

0 Kudos
Message 12 of 16
(2,424 Views)

Hello Sefaa,

 

@Gilfoyleto collect thermocouple sensor datas that are connected NI 9213 module on CompactRIO with C# WPF application at sampling rate 100 ms. 

Without touching LabVIEW FPGA, we will need to also use LabVIEW Real-Time to run on the CompactRIO since there is no direct C# WPF interface with cRIO real-time.  I envision your application will be as such:

TC -> 9213 -> cRIO with LabVIEW Real-Time application <-> C# application on your PC.

The connection between the cRIO and the C# application will likely be via TCP or web services.

 

This is more roundabout than just using LabVIEW for the UI and logic, but if you need to find a reason to use C# WPF to practice/learn it, this method should work out.  You will have to make sure you are doing the communication between your LabVIEW Real-Time VI and C# application well though.

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

I see you sir, but as you said this would be roundabout way to access datas. There is no meaning doing this.

But let me ask you another question. Doing this is not possible with 9025 and 9073, oke.

 

Is there any compactRIO that I can do this task? I am asking this to you because when we buy a CompactRIO, I will be sure that to access to the modules on the CompactRIO directly with C# WPF Application is possible.

0 Kudos
Message 14 of 16
(2,410 Views)

sefa, the only CompactRIOs that will be able to work with the DAQmx API like you are using with your PXI system is the cRIO-904x series.  You can find them in the shop by looking at CompactRIO Controllers and then filtering the Programming Method field to only show those that support NI-DAQmx.  You can read more about cRIOs that support NI-DAQmx in What is CompactRIO with NI-DAQmx?  NI's thermocouple modules (9210, 9211, 9212, 9213, 9214) are supported in NI-DAQmx as we can see in the compatibility chart (https://www.ni.com/en/support/documentation/supplemental/08/c-series-module-and-compactdaq-compactri...)

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

Excuse me, Kemens.

 

Previous I use measurement studio C#  for AO. But now I am in a new group and we only have cRIO-9039, could the cRIO-9039 be used as a AO using measurement studio C# ?

 

Are here any C# examples for this ?

Thanks.

0 Kudos
Message 16 of 16
(1,896 Views)