09-19-2011 12:24 PM
Hi All,
I am collecting data using two SCXI chasses with 1120 amplifier modules and SCXI 1112 thermocouple modules.
I am monitoring 12 input voltages and 4 thermocouple inputs.
I have set the samp,e rate to 2500S/s, and I am letting the software figure out how many samples to take each measurement.
Most of the time, the system runs fine, at about a 16ms loop time. However, every few seconds, the system will hang up for ~500ms or more between readings. This only happens when I am logging data to a text file. When I have the logging function turned off, the system never hangs up.
Any thoughts as to what could be causing this and how to fix it?
Many thanks!
09-19-2011 12:30 PM
09-19-2011 12:31 PM
Yes, do your logging in a parallel task so that it will not impact the data collection. When you do it within the same loop as your data collection you take the hit for the file I/O. There is a variety of ways you can pass the data to the logging task. You can use a queue or a notifier to pass the data. If you have your data accumulated during your data collection you could use a functional global to store the data. Both loops can access the data via the functional global. Since your data set is not that large I would use a queue to pass the data.
09-19-2011 12:33 PM
If I have broken a rule in posting a question about a related but significantly different issue, I apologize. However, I have ruled out the primary failure mode I suspected in my first post, and have moved on to another suspected failure mode, thus the change in subject line.
09-19-2011 12:42 PM
It looked like you had the same text in both messages. If you truly have a different question, then post a new thread. But then I would suspect your message would look substantially different.
If you have a related question, then you should keep it in the same thread that way the continuity of the discussion continues. Since you said, "hey I don't think it's this problem anymore, now I think it's this", you are basically continuing with solving your same problem and should stay in the same thread.
09-19-2011 03:59 PM - edited 09-19-2011 04:05 PM
Hi Mark,
This sounds perfect, but I lack the technical knowledge to put your ideas into code. Any chance I could get you to either post code (I am running LV 2010, V10.0, 32-bit) or post a picture of the associated block diagram?
I found the "Queue Basics" VI in queue.llb. Am I on the right track?
Thanks again.
09-19-2011 04:22 PM - edited 09-19-2011 04:24 PM
Yes, that is basically what you want to look at. You should also use the "Find Examples" to look at the shipping examples for queues.
Here is a very basic piece of code which illustrates what I was suggesting.
This simulates collecting data in the upper loop. Every 250 points it posts the collected data to the queue for the lower loop to process. In this example I do nothing more than update the indicator. In your case you would want to put the code there to write it to file.
09-19-2011 04:35 PM
That's what I thought you meant. Thanks for posting it.
My main thread uses state machine architecture. Looks like I would have to build a second loop, outside the state machine, to do the logging. Please let me know if that is not correct.
09-19-2011 04:38 PM
Yes, that is what I have been suggesting. If you keep the logging in your state machine you will take the hit on the performance because the file i/o is slow. If you separate it out your data collection loop will be unaffected by the data logging.
09-19-2011 04:40 PM
Understood. I am such a gumby at this, I just wanted to make sure I was comprehending the obvious. I will set it up and run as you suggest.
Thanks for your help and patience.