Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to perform scan mode averaging on the CompactRIO?

We are currently using Scan Mode on the CompactRIO, but the analog input channel has some noise on it and we would like to perform some time averaging (e.g. average the last N samples).

 

I am currently using the Mean PtByPt.vi on the RT side, but it is using significant processor power when the loop is run quickly. Is there a way to have the Scan Engine do this for me? Or am I better off writing something in FPGA to handle this?

 

-Nate

0 Kudos
Message 1 of 7
(3,845 Views)

Hello Nate,

 

There is no built in feature to get the Scan Engine to do the averaging for you.  An FPGA VI is probably what I'd recommend if you need to offload processing.

 

Out of curiosity, how fast are you running your loop such that you run in to problems with CPU usage?

 

Thanks,

 

Sebastian

0 Kudos
Message 2 of 7
(3,844 Views)
Well, typically I've been using a Wait until Next ms with a 20 ms constant. However, what I didn't mention is that I actually would like to go significantly faster (say 1 or 2 ms) so that the latency caused by the averaging is not so long.
0 Kudos
Message 3 of 7
(3,842 Views)

Nate,

 

You mention that you are using the Wait Until Next ms function.

 

Do you have the scan engine configured to run at the rate you would like? You do this from the controller's property page in the LabVIEW Project.

 

You should then use a timed loop and select 'Synchronize to Scan Engine' as the timing source.

 

Kurt 

0 Kudos
Message 4 of 7
(3,832 Views)

To add to what Kurt said, the IOV is only updated once per scan, so it is important to synchronize to the scan if you want to a) be sure to get every update and b) ensure that the same value isn't read twice.  

 

Sebastian

 

 

0 Kudos
Message 5 of 7
(3,826 Views)

Kurt, Sebastian,

 

Excellent points! I have changed the loop to Synchronize with the Scan Engine.

 

-Nate

0 Kudos
Message 6 of 7
(3,807 Views)

Nate,

 

Glad to hear it.

 

Are you still having difficulty doing the average with reasonable CPU usage?  What sort of usage numbers were you seeing / what was N?

 

Sebastian

0 Kudos
Message 7 of 7
(3,799 Views)