06-27-2014 03:28 AM
Hi, I am new to LabView therefore I know that the thing I am trying to do is relatively easy, however, I am stuck.
I made a small program which gets 5 measurements (for now substituted with random numbers) and together with time and date writes them to text file. I plan to run the program for long periods of time, therefore, I want to increment file name/path every hour, but after adding this part the program doesn't create any file, although the program runs with no errors.
Block diagram is in attachment, could someone point out to me what is wrong and what I should do to achieve my goal?
Thanks in advance!
Solved! Go to Solution.
06-27-2014 03:41 AM - edited 06-27-2014 03:43 AM
Hi Marcis,
when you change a VI and it doesn't work afterwards you need to check/debug your changes first…
How does your filename look like?
What's the goal on incrementing zero all the time?
Why do you open the file each time, but only close it once the time is elapsed?
06-27-2014 03:46 AM - edited 06-27-2014 03:57 AM
My file name looks like TXT_test_XXX where "XXX" is a three digit number.
Yes, there is absolutely no point in incrementing zero all the time, already noticed it (though after posting question).
Why would the program open the file multiple times? Open file function is not in a loop?
Best regards,
Marcis
06-27-2014 04:03 AM
Hi Marcis,
you only close the file when the time has elapsed. Depending on time target you may will open the file multiple times: ElapsedTime will return much faster than your loop with the result "not elapsed" due to DATAFLOW…
06-27-2014 04:05 AM
Hi marcis,
Acually the program logic was totally wrong.
1.Feedback the file path will never help you. Because after leaving from while loop, the case structure will run once and LV will stop execution.
2. Open and close the datalog file only once. Try to do all your manipulation between the open and close of your datalog file. Otherwise it will be difficult to handle when you develop your code.
3.Case structure outside for loop is meaning less. If you want to run the program continously, place all the function inside the while loop which you would like to execute. While loop will execute continously until condition get satisfied.
4.Bad data flow. Every programmer must good with data flow.
Just go through the labview basics here and try to realize your logic again
All the best!!!!