LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with logging data

Solved!
Go to solution

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!Write_text_data.png 

0 Kudos
Message 1 of 5
(2,676 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,668 Views)

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

0 Kudos
Message 3 of 5
(2,661 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,650 Views)
Solution
Accepted by topic author Marcis

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

Spoiler
Spoiler

 

All the best!!!!

0 Kudos
Message 5 of 5
(2,648 Views)