|
Re: cRIO data logging
There probably isn't one pat answer or it would just be built in.
The simplest to use are the single icon blue functions. Easy, but probably not highest performance, and not as much control.
A step up from that is to open the file once, store the refnum or pass it through the looping element. Each iteration adds to the file with a write text or write binary, possibly flushing the file. The flush ensures that the underlying file manager actually writes the info it may be caching into the disk representation of the file and will ensure that a power outage or crash will not lose data. Outside of the loop, you can close the file and zero out any info you may have about the log.
If either of these simple approaches works, stick with it. If not, you may need to introduce your own caches or find ways to sneak the I/O writes in and have less impact on execution. You can keep info in arrays and write the info to a new file all at once. You can alternately put the file I/O into a background priority subVI and use queues or RT FIFOs to send data to the logger and allow the logging to proceed whenever it has enough info and CPU. I'm sure there are lots of other tricks that can be applied as well, but as usual, start simple and determine where that gets you.
Greg McKaskle
|