06-19-2012 07:28 PM
Hello,
I was wondering if I could please get some help.
I currently have a problem with my data logging system (running in LABVIEW 7.1) that when I increase the sampling to a once every few seconds (as opposed to before where it was once every 3 minutes) the computer will freeze or crash after about 6 hours. Labview doesn't ever log the error or tell me that it crashed, all I know is that after some time when I do heavy data logging the machine crashes.
The program I think is supposed to be pretty simple. I am asking my program to read 4 thermometers, in which it is returned to me as "Dynamic Data". I am also sampling from two Serial devices (Pressure Sensors) to which I am obtaining pressure and temperature data and this is returned as a "String". I then want to save both data into a spreadsheet and so I convert all data so I can fill an array to then write to the file.
I think it has something to do with "memory leakage" and that my program continues to build arrays inside the loop. I have looked at the following NI links for guidance.
http://www.ni.com/white-paper/4537/en
http://zone.ni.com/reference/en-XX/help/370622J-01/lvrtconcepts/avoiding_shared_resources/
Before I hadn't been pre-allocating my array and I have now have ensured I have prelocated my array outside the loop and that I open and close the file outside the loop however I still run into the same problem.
Any help from people more experienced in data logging is much appreciated.
06-19-2012 08:20 PM
Greg314,
You are not building an array which keeps growing. You build an 8-element array over and over. That is not likely your problem.
You only need one Write to File. Just conatenate the strings and do one write.
I cannot see inside the DAQ Assistant or the II/O Assistant, but I suspect that the problem may be in repeatedly intializing and closing the tasks. Connect the error wires via a shift register. Consider stopping if an error occurs. This may help you locate the cause of the problem before the computer freezes.
Temporarily put an indicator on the "i" terminal in the loop. It can be a useful monitor of activity.
Lynn
06-19-2012 09:00 PM
Hi johnsold.
Thanks for the advice. Yes it did make more sense to just use one write.
Addtionally you now made me consider the DAQ Assistant.
I had a look here ** and I realised I only had it reading 1-sample (on demand). I am guessing that this could be opening and closing continuously causing the problem. I have now changed it to "N-Samples". I will integrate a shift register with my error wires to make my program more easily find a fault.
Thanks for the help. I will update this thread should this fix it (or the error be more clearly identified).
[**]http://digital.ni.com/public.nsf/allkb/B86AA2D2FDE9A16086256FFC0060420
06-25-2012 11:16 PM
Hi johnsold, I have been unable to solve the problem. I connected the error wires via a shift register and only encountered errors when I changed the Sampling rate to "N-Samples". The program still worked and the computer still crashed all the same. The error messages in this case was Labview error code 200010 which I am unsure what that means but I don't think it is related. I am now back to 1 Sample on Demand for the DAQ Assistant and no errors are reported but the program continues to crash after 8 hours (roughly 10000 iterations of the loop). I have a work around solution now. Since it crashes after 8 hours of sampling about once every second, I have changed the sampling time to be much less frequent after a few hours (and later on use a program to interpolate the readings so that they are all at the same time scale). Thanks for the help. There is not much else I think I can do at this stage.
06-26-2012 07:11 AM
Hi,
you may be correct about the memory leakage.
The two culprits I see are:
1: Convert from dynamic data
2: Build array
They both create a copy of the acquired data. To get rid of 1. you would have to ditch the DAQ Assistant. Number 2. seems to be unnecessary - the graph should work with the 1D array.
Best regards Florian