03-03-2009 04:20 AM
Hi guys,
i left a test program i'm writing running over night last night, it is logging data to file from a PLC and reading data from files and outputting this via the PLC.
It locked up after a couple of hours and task manager showed it was using 100% processor. (the PC is well speced)
The data it was handling from the PLC had all been logged correctley to different files with date stamps etc...
I'm wondering what could cause the 100% processor usage ?
The program is a sequence structure with the last sequence having a loop with a few case/sequence and subVI's in it. But ultimatley the only continouus operation is the loop which has an exicution delay off 1 second.
In fact i'll stick a picture on so its clearer.
Cheers Zac
03-03-2009 04:43 AM
Hi there,
The problem you are facing is probably due to the write to spreadsheet file... If you look into that VI , you will see that it opens and closes the file everytime you access it. This means that the PC has to open the file, then search for the last row of the spreadsheet, and then write. As times goes on, the file gets larger and larger, and the CPU will starve searching for that final line.
The best way to avoid this would be to remove the open and and close file VI from this SubVI and place these on the top VI.
I hope this helps,
Matthieu
03-03-2009 04:45 AM
Hi there
sounds like typical symptoms of memory leakage. Search for references which are opened but not closed during execution.
03-03-2009 04:47 AM - edited 03-03-2009 04:49 AM
Hi Zac,
which history length do you use in your chart? You don't need to build your data into two arrays. You can also connect dbl to the write function, or you use only one format into string function.
Mike
03-03-2009 04:49 AM
Thanks for the info guys,
i will have a look.
The chart history length is 86,400 (24hours)
Thanks, Zac
03-03-2009 04:54 AM
Hi mike,
i build the data in to two arrays as i have to log it to file as strings (as one of the items is a string i have to convert all the others), if i try to use the string array output on the graph it cocks up the time axis on the graph so i added a second array of dbls just for the graph. Is there a better way to do this ? can i for example convert the one string into a dbl then i dont need the string array.
cheers, zac
03-03-2009 05:00 AM
Hi zac,
you can use the "Array to Spreadsheet String" function to build your string. If you change the store method, open the file before the loop, close it after and write the values inside of the loop, then you can directly use the "Write to binary file" function.
Mike
03-03-2009 05:21 AM
I have just tried using the "array to spread sheet string" function, but i need to add to this 1 item of data that is allready a string, and i cant see how to do that in your example, i tried a second array (see image) but it messed up position of the data in the file.
I have 1 string and 23 doubles that i want in a single file, so to get thses into a single array i was converting all the dbls into strings as i couldnt convert the string into a double.
Cheers, Zac
03-03-2009 05:31 AM - edited 03-03-2009 05:31 AM
Hi zac,
sorry, you can use the "Number to fractional String" it also works with arrays (depending on your LabVIEW version).
I recommand the use of the transformation code to remove one build function.
Mike
03-03-2009 06:01 AM
sorry but i don't see the advantage of using "Number to fractional String", i still have to use one per double and feed these and the string into an array of strings which can't goto the graph (without messing up the time axis), so i need an adtional array of just the doubles, which can go to the graph.
cheers, zac