02-20-2012 08:57 PM
I'm having some trouble with a Scan Engine to RT acquistion on 9012/9112 and 9076 hardware, with a 9205 module.
Overview of symptom: The Scan Engine is set to 100Hz and I am using a synced timed loop to read the data out of the 9205 module. Roughly 1/sec we drop a point (sometimes 1 point over a second, sometimes 2 after a clear second).
Details:
1) This is the standard Scan Engine. I don't load a custom FPGA bitfile. I set the scan engine period with the Set Scan Engine Period VI.
2) The Timed Loop is synched to the scan engine.
3) We are able to run up to about 250 Hz with this setup and get the same number of missing points- also the RT CPU utilization is <50%. So I don't think it's a problem in RT.
4) (I don't have the code in front of me now, so I forget the names) but I am using the functions that allow you to scan the entire module programatically with one call, using the reference.
5) The data is fed to an RTFIFO and passed to a std while loop for logging. This FIFO does not come close to filling.
6) Since this seemed to be well within the confines of the hardware, I have not put a lot of time into checking the loop errors to see if anything finished late.
NOTE: I am not using the shared/network variable engine, just the RT FIFOs.
When I get back to my dev machine, i can post some code. But I am concerned as to why this would have loop errors posting data to the RT engine at a rate of 1/100 or so at 100Hz scan rate for one module.
Any ideas?
02-21-2012 09:41 AM
I forgot to attach this image of a sine wave acquisition to show the missing points. I have redesigned the code to pull down the error flags and window time stamps from now on.
02-21-2012 05:08 PM
Hello Jed,
Can you try reproducing this error using some example code? Open up the example finder (Help --> Find Examples), and navigate to:
Hardware Input and Output --> CompactRIO --> NI Scan Engine --> Module Specific --> Analog Input --> NI 9205 Getting Started - Scan Mode.lvproj
You'll have to follow the "Using this Example.htm" document that is in the project when you open it up.
02-22-2012 10:42 AM
Thank you for your response. Using some slightly more powered hardware, I have determined that it really is the Scan Engine getting over-burdened, even at 100Hz.
Looking into alternative architectures.
02-23-2012 09:04 AM
You can easily obtain 100Hz on a cRIO w/scan engine. Just make sure that you use the Direct Variable Read vi so that you are not using static IOV nodes or continuously opening and closing IOV or SV references.
02-23-2012 11:51 AM
> Just make sure that you use the Direct Variable Read vi so that you are not using static IOV nodes or continuously opening and closing IOV or SV references.
Right now I am using "Scanned Variable Read", with a mix of the 9205 (analog input), 9235/9236, 9237 (bridge, delta sigma) and possibly the 9234 (also delta sigma, I think) modules.
I open a reference to the RSI Module early on and then use the Scanned Variable Read in a loop. Should I be using Direct Variable Read instead?
Some other info...
1) Due to some other issues, the NI support guys had me reformat the flash on the 9076 and reinstall the same hardware. This alone has increased the performance. Still not sure why. (We have a second unit sufferring from the same issues).
2) We tried the same code on a 9012/9112 (same controller, newer FPGA with roughly the same number of gates). The 9012 ran it up to 250Hz easily; Was thinking that there was something in the FPGA that was causing the Scan engine to get bogged down.
02-23-2012 02:05 PM
Jed,
It looks like you're heading down the right path in the service request that you have open with the support team. I notice that you were linked to a couple of developer zone articles:
NI Scan Engine Performance Benchmarks
Using NI CompactRIO Scan Mode with NI LabVIEW Software
And also that you're going to use the execution trace toolkit to figure out what is delaying the timing.
With regards to the FPGA slowing operation down, the FPGA hardware shouldn't make a difference in your maximum acquisition speed for your real-time controller. It sounds like there are some differences between the controllers that you're using (perhaps in the installed software, perhaps the 9076 is still having some issues). Are you certain that both projects get set up the same between your tests of the two programs?
02-23-2012 02:18 PM
I only use the Direct Variable read in situations where I have a subset of channels that need to run at a high speed and the rest, under scan engine timing do not need to run as fast. Otherwise, the method you are using is fine.
02-23-2012 02:56 PM
Colden,
The only change I make when swapping units is to change the IP address in the project and connect the new device. Is this not OK, as they are only running in Scan Mode (no FPGA custom code)? Or should I create a new project that is essentially the same, except for the device specification? This seems tedious, as the two systems have the same RT controller.
Actually, this brings up a quesiton about Scan Mode. How is the Scan Engine bitfile loaded? Is it default on the unit? Is it loaded when an EXE with a scan engine call is called in RT? (I just played around and created a project where the target was set to FPGA made, but the Scanned Variable Read function worked for any module that wasn't specifically moved into the FPGA section. But I never specified anything to do with Scan mode).
Note: I have written this code that allows any module to be plugged into the chassis, even if I did not specify that module in the project; it still pulls down the data correctly.
So basically, after I compile to EXE and push to the target, I can change modules without code changes. The RT code self-detects the modules and then calls appropriate functions based off what was discovered.
Honestly, I think I need a better understanding of what is happening when I use Scan Mode and/or FPGA code on the device. Where is the Scan Mode bitfile generated, stored and loaded from? Does it change depending on RT or FPGA target? Can I generate it once per device, embed it on the device and then ignore it? Can I force a specific scan mode bitfile to run? Etc.
02-23-2012 03:00 PM
Thanks for that info. We are running a Read-Only application where we want all the channels from all the modules logged as fast as possible. We are using controllers with USB flash drives and occaisionally sending the data out over UDP.
Now that we are discussing, I think I may have been pushing an innapropriate Scan Engine bitfile onto the 9076- if that's possible.