From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-24-2016 02:12 PM
Hi,
First I will explain my VI.
I programmed this VI to acquire Images from 2 cameras and Data from a spectrometer simultaneously every 5 minutes.
That Images and Datas are separated per day at different pastes using the number of times the Datas are acquired.
The problem is the following:
When I run the VI in normal mode sometimes it doesnt work at all (without an error message). But other times it can work for about 20 acquisitions and then it stops without an error. When I highlight the VI after that happens I have the following image in " error.jpeg ".
When I run it in Highlight mode it usually works, but I haven't tested for long periods.
I believe the bug has something to do withing timing or race conditions, but I don't know how to fix it.
Thanks in advance for your Help,
Oscar
06-24-2016 02:14 PM
OH, I forgot to mention that the program doesn't just stops, it freezes !
Tks
06-24-2016 04:36 PM
Is error.jpg just supposed to be a picture of the Block Diagram of your main VI?
It is pretty difficult to figure out what you are trying to do, with all those wires running all over the place, no sub-VIs, no labels to hint at what is being done. You seem to be writing at least three files (two PNGs and a Measurement?). Note that you have a single timed loop (why?) that contains both the Grab and the Writes.
First question to ask is "Who is the Boss?". Who controls the Clock and sets the timing for the loop? If you are taking Videos, it is not uncommon to set the camera to a particular Frame Rate and let the camera be the clock (it should wait until it has an image to give you, making it "run" 30 times/sec if you have set it to 30 fps).
The single VI that you attached does not show us all of the code -- there are missing sub-VIs or functions that generate data being written to the Measurement File. What is this? How is it "clocked"?
Going back to my previous question about who controls the timing, it may be important that each camera and the DAQ device "fire" at exactly the same time, in which case having them inside a timing loop may make sense, particularly if you understand that on a Windows PC, timed loops are not particularly accurate or precise (certainly not as good as the hardware inside the camera).
As far as the timing problems, you are trying to do too many time-critical things in a single loop. You would probably benefit from a Producer/Consumer Design, with the cameras and DAQ device in a Producer Loop, putting data onto a Queue that then goes to the Consumer loop for writing to the three files.
Bob Schor
06-24-2016 07:57 PM
Is that a timed loop... inside of a while loop... inside of a case structure?
Please tell me no.
Beyond that, if the problem doesn't exist in highlight, you're either looking at a timing issue (something you could check by adding delays) or more likely a race condition.
Can we begin to troubleshoot that picture? No. Can you get parts of the application to work on their own? Does the problem exist when you have everything together?
06-25-2016 08:24 AM
07-04-2016 03:45 PM
Alright, so I went with the advice of separating acquisition in Producer and Consumer loops and the result is VI attached (you can see it in the images too). I tried to make it more easy for you to understand too..
aand the good news is: IT WORKS JUST FINE !
The images and datas are being acquired and saved normally for long periods of testing. But I still have a few problems to solve.
- I'm using Wait Until Next for timing and it doesnt meet my requirements (the number of images acquired by each camera is not necessarily the same). I wanted to know if there is a better method for synchronizing the Producer loops at 1 acquisition every 5 minutes.
- The function I created for automatically create Incremental New Pastes after a certain number of acquisitions (which is connected to the stop in each Consumer/Producer loop) sttoped working. How come?
- Is there a way to control the number of iterations in all Consumer/Producer loops with only one control in the Front Panel ?
That's all I need to solve for now. I appreciate very much the help.
Thanks !
07-04-2016 03:46 PM
The images are attached below 😄
07-06-2016 11:55 AM
07-07-2016 06:10 AM