03-03-2009 04:33 AM
Gurus,
I am using a large, but uncomplicated data acquisition program. I generate two 2D-arrays queues from reading and writing to an analogue in/out card at 10Hz in a timed loop. A couple of parallel timed loops preview the queues and average these once per second to produce two 1D array queues.Let's call them the temperature and flow queues.
An another timed loop does a couple of serial port read/writes per second to produce a 1Hz counts queue. In this loop, the temp and flow queues are called (previewed), and along with the counts converted to array of strings and written to file at 1Hz.I put offsets in my loops to hopefully allow 10Hz stuff to update before the temp and flow queue average before the counts timed loop previews them.
Although the time stamp increments in the file, I am losing seconds/system is running slow.....
Is this good programming or should I be looking at otherways of handling this data?
Paul
03-03-2009 05:10 AM
The offset can not guaranty the correct order of the code flow.
Use a notifier. You should be able to add one without big changes in your code
03-05-2009 03:51 AM - edited 03-05-2009 03:53 AM
Thanks for that. New to Notifiers, so need to do some reading.
Looking quickly at this, are notifiers some sort of data queue? It looks like you could acheive the same result with a queue and some functional global variables.
I also read on the help that the if a notifier is in a loop it creates a new reference on each iteration (effective memory leak). Anyway to avoid that? I am running stuff at 1Hz - 10Hz for several days-weeks.
Paul
03-05-2009 05:01 AM
The Obtain Notifier will be outside the loop, the Wait for notification will be inside. No memory leak.
I think you can achieve the same with just a functional global. A boolean with two states