07-24-2009 08:34 AM
I have had to ammend my software for better efficiency. I am to log data once every 5 seconds for 24 hours. After that time, the contents of log file should be replaced by a new set. This should continue until the program is stopped. I have tried using sequence structures but this has not worked.
Any suggestions please?
07-24-2009 08:47 AM
Hi maxidivine,
i think you should use a loop to accomplish this. What type of data do you log? Do you reset the entire file after 24 hours or only one value?
Mike
07-24-2009 08:53 AM
This should do the every 5 seconds all you have to add is the file IO inside the case structure
07-24-2009 08:57 AM
Well, it seems to me that in recent times more and more people tend to use sequence structures (of anykind) instead of proper architectures and therefore are running into more or less serious issues.
I think it is time that sequence structures should be removed from LV with two exceptions:
a) Single Frame
b) FPGA Module
But since this is most probably not going to happen, we have to go on answering in such a way: "Use proper architectures!" *sigh*
Now to answer maxi's question:
You have to collect data and pass this to a function group which writes the data to disk. This function group is to be executed once each 5 seconds. Therefore i tend to recommend parallel loops with proper data transfer mechanisms (queue). So i suggest you to look into producer/consumer architecture found in the template browser (file >> new).
hope this helps,
Norbert
07-24-2009 09:14 AM
Mike is correct. You could use a Wait(ms) or WaitUntilNextmsMultiple vi with 5000 wired to it in a While loop. If you're not using event driven code then your vi would become sluggish, acting on button presses every 5 seconds. In that case, you could, say, wire 100 to the Wait then execute your logging every 50 iterations. (You could use the Quotient & Remainder vi to compute the modulus. When i mod 50 == 0 you execute.)
Ed
07-24-2009 11:35 AM