11-01-2018 01:04 PM
Hi all,
We are building a labview application to monitor and control a manufacturing line.
Labview is installed on the main PC that operates the line.
Since some sensors are operated on their own PCs, we want to record the timings of all measurements of these sensors on the main PC to centralize the timings of all mesurements.
The sensors generate spc files (spectral data) more or less every 10s in a directory of their own PC.
How is it possible with labview to record that filename and the time (time of the main PC with labview) when the file appears on the sensors PC.
I tried the list folder function but it gives all files and not the new ones.
11-01-2018 02:10 PM - edited 11-01-2018 02:13 PM
@brevan wrote:
I tried the list folder function but it gives all files and not the new ones.
Well try storing the results in an array, then read it again later and compare the new list to the previous list.
11-01-2018 02:21 PM
Another route you can try is to treat the original SPC file location as a temporary holding location. After a file is detected in that location, note the time and move it to an "archive" folder. This way, your normal save location is normally empty, unless a new file appears. Additionally, you will avoid timing issues later on as the number of files increase. The list folder function will take more and more time as the folder grows. Even small files will result in a notable increase in processing time as their numbers exceed millions within a single folder.
11-01-2018 08:20 PM
I think that you should use a real server to store your data... like a NAS.
Why you are not using a database?
Benoit
11-01-2018 11:12 PM
Don’t have LabVIEW here, but you can make a .NET callback function that can let you know when new files are added. It is somewhere here on the forums because that is where I remember finding it.
mcduff
11-02-2018 08:23 AM
@mcduff wrote:
Don’t have LabVIEW here, but you can make a .NET callback function that can let you know when new files are added. It is somewhere here on the forums because that is where I remember finding it.
I just did this for TestStand. But the System dll has a class called System.IO.FileSystemWatcher. From there are the methods and properties that the OP needs.
11-02-2018 10:13 AM
This is what I did a while back, have not used it in a few years. I do not like posting .NET and callback VIs as there are usually problems with them when I try to run them.
This VI watches a specific directory and sends an event if the contents change.
This is the callback VI
Note in the FileWatcher VI I split the events, I remember if I tried to combine them then LabVIEW would crash, no idea whether that bug/feature has changed.
mcduff