LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating RMS value of data samples in RT

I am using CompactRIO 9014 in my control application. I am acquiring data from NI 9215 module. I want to calculate RMS value of data coming from this module for monitoring of the system. I want to include data samples within 1sec to calculate RMS value. I am sampling at 25KHz rate. I want to use RT for processing there a way to do this? I am using Labview 8.6. 
0 Kudos
Message 1 of 14
(6,263 Views)
try the "AC & DC Estimator VI "


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 14
(6,248 Views)

suni wrote:
I am using CompactRIO 9014 in my control application. I am acquiring data from NI 9215 module. I want to calculate RMS value of data coming from this module for monitoring of the system. I want to include data samples within 1sec to calculate RMS value. I am sampling at 25KHz rate. I want to use RT for processing there a way to do this? I am using Labview 8.6. 

 

Hi suni,

 

Yes, you can do the processing on the RT host - that's actually the recommended way of doing things. I suggest using a DMA FIFO to transfer the data from your FPGA to the RT host, however you don't want to make your FIFO 25k elements long. Instead, you can write/read the FIFO in chunks (recommended size is under 8196 elements). Then, as long as you're reading from the FIFO at a reasonable rate on the RT, you should be able to pull out the elements and perform the RMS calculations. 

If you're new to FPGA, I highly recommend looking at the examples in Help > Find Examples > Hardware Input and Output > compact RIO. A lot of them demonstrate communication between the FPGA and RT hosts. 

Hope this helps! 

 

Misha
0 Kudos
Message 3 of 14
(6,223 Views)
Why wouldn't you recommend performing the RMS measurement on the FPGA.  There is a RMS function in the FPGA pallete.  We have observed that the RIO RT processor is underpowered while this seems to be a classic case of using the FPGA to offload the RMS function.
Stu
0 Kudos
Message 4 of 14
(6,182 Views)

I tired to use FPGA read/write node to transfer data from FPGA instead of using DMA FIFO to transfer data from FPGA. What is the best method to do this transfer of data ( I want to do this deterministically) ? If I use FPGA to calculate RMS value of 25k samples that would take lots of memory in FPGA right?

 

Thanks for all the help

0 Kudos
Message 5 of 14
(6,174 Views)

using the fpga to calculate 25k sample rms would not take more memory than any other number of samples.  if you look at the implementation, it provides 1 measurement of RMS every n samples.  if you want 25k samples, fine.  The drawback to the NI RMS function is that it ONLY gives a single measurement every n samples as oposed to a running value.  i would suggest using the hanning window option if your sample period is not an integer number of cycles of the underlying periodic wave or if you are measuring something that is not periodic.

 

Stu
0 Kudos
Message 6 of 14
(6,171 Views)

Thanks for the reply.

 

Is there a way I can display power spectral density (PSD) of a signal in FPGA vi or in RT vi. I don't think FPGA functions palette have this function. I can do this in RT code if I can send data to RT target. I think. I am sampling at 25kS/S rate in FPGA. If i need to do this in RT vi I need create waveform 1d array type of data. Because PSD function takes waveform data. But from FPGA i am getting only integer values. Is there any way i can accomplish this.  

0 Kudos
Message 7 of 14
(6,113 Views)

suni wrote:

Thanks for the reply.

 

Is there a way I can display power spectral density (PSD) of a signal in FPGA vi or in RT vi. I don't think FPGA functions palette have this function. I can do this in RT code if I can send data to RT target. I think. I am sampling at 25kS/S rate in FPGA. If i need to do this in RT vi I need create waveform 1d array type of data. Because PSD function takes waveform data. But from FPGA i am getting only integer values. Is there any way i can accomplish this.  


 

suni,

 

You'll have to perform the PSD analysis on the RT vi. All you need to do is send the data from FPGA over to the RT host (for help on how to use the DMA to transfer data, see the example at Help > Example Finder > Hardware Input and Output > Compact RIO > FPGA Fundamentals > DMA). You can then build a waveform from those values by using the Build Waveform VI and pass it to the PSD function. 

 

 

Misha
0 Kudos
Message 8 of 14
(6,086 Views)

Hi,

 

I tried to use NI FPGA RMS function to calculate RMS value of analog signal that i am acquiring. I noticed that rms value is displayed and returned backed to zero real fast. I am sampling at 25ks/s rate. You mentioned that NI RMS function returns single measurement every n samples as opposed to running value. Is there a way to keep that calculated RMS value instead of returning it to zero until next rms value is calculated.

0 Kudos
Message 9 of 14
(6,050 Views)
the output of the rms function has a "results valid" boolean output indicating that the RMS result is valid.  Your program should use this boolean to latch the RMS value and ignore it the rest of the time.
Stu
0 Kudos
Message 10 of 14
(6,039 Views)