LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW cRIO9074 Current voltage measurement

I want to measure voltage and current through cRIO9074 and I have CRIO9074 and NI modules NI9227 (current) and NI 9225 (voltage) for measurements. I am measuring the current for load emulator and voltage for grid simulator, but I am unable to set up the sample size/ sample rate for accurate measurement, the sine wave is also not accurate as per the screenshot attached. Power measurement is also not accurate. I have also considered CT ratio for current 5/50 while calculating RMS power by using electrical toolkit(as per image attached)

 

0 Kudos
Message 1 of 18
(1,890 Views)

Pictures are nice but pretty useless for debugging.

 

Anyways, you have a cRIO with FPGA hardware but only use the software RT part with shared variables and in a software timed loop and expect accurate timing. That is not really going to work.

 

There seems also lots of redundant code. Reading AI0 4 times to do something in parallel is really not useful. That read of the AI0 shared variable is one of the main contributors for your loop execution time, so doing it 4 times is simply wasting CPU time for no good reason. Shared variables are really network variables. Each access to it needs to go through a whole slew of driver levels and some communication channel that is software abstracted to a common interface. That takes a lot of time and expecting to access a value through this interface several 100 times per second is pretty much a pipe dream.

 

If you want a real time operation that delivers meaningful data, you almost certainly will have to venture into the FPGA capabilities of your haredware by writing the low level control part of your control system on the FPGA hardware and communicate the results of that through DMA channels to your real time application. In this way you can get accurate loop timings way below 1ms and have the host application only be concerned about reading the DMA data and displaying it on your graphs. Yes it is quite a bit more complex to program since FPGA programming is somewhat particular, while RT programming is for much of it similar to normal LabVIEW programming. Also you end up with at least two systems that you need to program, so maintenance and documentation is more demanding if you don't want to create a 5 headed monster that will be incomprehensible even for you in a few months.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 18
(1,874 Views)

I do not want to go with FPGA mode because in FPGA mode I can not run my program written based on the results of this program(reading V &I and calculating power then based on this power giving command to another inverter through reference V calculation based on power/load parameters).

 

Is there any simple way to write this program in RT scan engine mode only and get better waveforms of V & I.

 

 

Thanks for your RESPONSE.

0 Kudos
Message 3 of 18
(1,867 Views)

As I pointed out there are ways to optimize your program somewhat. Not reading scan engine variables unnecessarily definitely should be your first step here. Also the scan engine has a scan interval that I believe is configured to 10 ms on default and can be set to 1 ms at most. There is a reason that it is not set to 1 ms by default. It is quite taxing on the system especially on an old target like your 907x system.

 

But setting it to 1ms likely won't solve your problems. The Scan engine mode is meant to be used for slow monitoring applications like temperature monitoring. It can not and will not work well for control applications that need to calculate new setpoint values from various input values unless you talk about control loop intervals in the second range, like oven control applications and similar.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 18
(1,855 Views)

what is the simple way to run it in the FPGA mode?

 

Can you please refer some document/article to run cRIO9074 and read/write command on it.

 

Thanks for prompt response.

0 Kudos
Message 5 of 18
(1,839 Views)

Hi Meharda. 

One of the best places for anything related to cRIO, fullcriodevguide.pdf (ni.com)

Kind regards
LabVIEW Fairy

cRIO Enthusiast
Please mark solutions when appropriate.
Unofficial Forum Rules and Guidelines
Message 6 of 18
(1,823 Views)

Can we get good resutls/waveforms in scan engine mode also because I want to run this program on scan engine mode itself?

0 Kudos
Message 7 of 18
(1,781 Views)

Depends what you want to measure. For temperature, pressure and similar slow changing measurements, the default 10ms sample interval should be more than fast enough and even assuming that there is a minimal jitter in the scan interval should not be a problem. If 10ms scan interval is tricky, you can go up to 1ms at most, but that may not really be enough if you want to do fast voltage or current measurements. For instance monitoring a 50/60 Hz mains signal will give you a pretty useless signal at 10ms scan interval and still not great waveform shape at even 1ms scan interval. If you want to measure even faster signals you absolutely and positively have to go the FPGA route and use DMA FIFOs to transfer the data to and from the FPGA.

Rolf Kalbermatter
My Blog
Message 8 of 18
(1,774 Views)

any solutions in RT mode, because my next connecting program will not work in FPGA mode. So it there any way to solve this voltage/current measurement issue in RT mode.

 

 Sample basic program is attached for your reference where I am using NI9227 and NI9225 for measurements but did not getting correct waveforms and power values.

0 Kudos
Message 9 of 18
(1,770 Views)

@meharda_92 wrote:

any solutions in RT mode, because my next connecting program will not work in FPGA mode. So it there any way to solve this voltage/current measurement issue in RT mode.


No! If you want higher speeds than what the scan engine can offer you have to go with FPGA. Or you could have gotten a cDAQ chassis instead. Those have preconfigured DAQ FPGA engines that can provide higher speeds. But there you can't program the FPGA anymore if you ever decide to want to do that. Technically they are very similar:

 

- cDAQ has preconfigured DAQ engine that lets you do almost FPGA speeds without having to program FPGA

- cRIO has either scan engine or FPGA programming that lets you do just about anything you can imagine as long as the hardware specs allow it and you can fit the code into the FPGA fabric.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 18
(1,763 Views)