LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to file taking too long.

Hi,
I have a peculiar problem :). I have used state machine architecture to build my code. In one particular state i write the data accquired and strore the wave form graphs as jpegs on the disk.
File open and close happen only once outside the while loop. I am using "Write FIle" vi to write the data. Data is first bundled into a cluster and then writte. I use "Write JPEG FIle" to store graphs as JPEGS.
When i create the executable and run, the program stops here in this state for an indefinite amount of time. (sometimes 60 secs, 80 secs)
and then continues. Multiple tests have confirem that the problem is either due to file write or JPEG write.
Can anyone please tell me the cause of error
what happens to all the pop ups (errors thrown by labview when running the program) when the program is converted ino an executable?
 
Rgds
Prithvi.
0 Kudos
Message 1 of 12
(4,005 Views)
Hi Prithvi,

can you attach your vi?

Did I understand your last sentence correctly: Your vi gives you errors/warnings in the development environment and you expect the executable to run without?

Best regards,
GerdW


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

Hi,

Attching the VI would be difficult since it is big. I am attaching the dataLogging part of the state machine. The size of the folder where the JPEG files is now 3.41 GB. Each JPEG is baout 39 KB.

The last statement of my previous question is a doubt. When we develop programs using labview and we run the program, if an error is encountered Pop Ups display the error. What happens if we convert the program into an executable and these errors occur?

 

 

0 Kudos
Message 3 of 12
(3,978 Views)

Your data logging portion of code did not attach.

Have you tried writing to a new, empty directory? 3.4G/39K = over 87,000 files in that folder. Could it be the OS is having a hard time with that many files? Just a guess.

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 4 of 12
(3,975 Views)

oops soory for not attaching the code part. i hv attached the code.

 

0 Kudos
Message 5 of 12
(3,959 Views)

I would have to say thar it is probably the write to jpeg portion of the code but i would also suspect it to be the size of the folder that is causing there problem. You can debug this by putting a case structure around the jpeg code with a constant true or false so that the code will not execute or if you have the disable structure just put that around it. Then run your code and see if still hangs at the same point.

How big is the other file that you are writing to for the write to binary file.




Joe.
"NOTHING IS EVER EASY"
Message 6 of 12
(3,953 Views)
The total size of the other file after all the runs (say 60) is about 3 KB. But for each run 2 JPEGS are created (each of size 39 KB). So about 39 * 2 * 60 (for 60 Runs) of space is used.
0 Kudos
Message 7 of 12
(3,949 Views)
I think Joe’s observation is a good one: the large delays may be caused by the number of files (and total size) in the folder to which you are writing. Have you tried creating a small VI whose only function is to create these jpeg files? Try a small test like this when writing to an empty file. If this gives the same behavior, then the delay must be inherent in the code and not in either the surrounding code or the folder to which the write takes place. I hope this helps! Thanks,

Mike
0 Kudos
Message 8 of 12
(3,917 Views)
Hi,
The size of the folder and number of files in the folder was the problem. Clearing the folder helped remove the delay.:manhappy:
I thank all of for your help and time.
But even when the folder contained a large number of files, writing into it sometimes took no time, sometimes 60 secs. the delay was not predictable. Is this delay inevitable as the size of the folder increases?
 
Thanks and rgds
Prithvi.
0 Kudos
Message 9 of 12
(3,911 Views)
Hi prithvi,

I suppose you work on a windows system. Windows may buffer the contents of a folder to allow faster directory queries. So sometimes your access is granted very fast,
sometimes not (= getting new directory listing)...
It's always a good idea to have a well structured folder tree for your files. Why don't you use subfolders for each measurement? Why don't you use a subfolder for each new day/hour, depending of the number of measurements done it that time?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 12
(3,902 Views)