08-02-2016 08:20 AM
Hi,
I am working on a VI that should acquire 2 images and 1 data (from a spectrophotometer) simultaneously. They are organized in 3 different producer/consumer loops.
What I want to do is to trigger the 3 Producer Loops synchronized every few minutes.
I thought about making the 3 producer loops into Event Cases that are triggered by a single loop with a timing function, but I don't know a practical way to do it.
If you can give an idea of how to pull it off I, or give me an example I would be already very pleased.
Thanks in Advance for your help,
Oscar
Solved! Go to Solution.
08-02-2016 08:39 AM
Unless your three P.C. loops are in separate VIs you could instead have one Producer handling three Consumers, and when you want all three consumers to trigger together it becomes a much easier task.
Alternatively, yes, make the Producer loops trigger of User Events, and fire a custom UE from another source.
08-02-2016 12:03 PM
So my question is more of how to fire this UE. Could you help me ?
08-02-2016 12:17 PM
User events https://zone.ni.com/reference/en-XX/help/371361M-01/lvhowto/creating_user_events/
08-02-2016 02:23 PM
I didn't quite understood how to addapt this method of Custom Event to my VI.
I'm sending my VI and a picture of my block diagram for you.
Please help.
08-03-2016 05:40 AM
Looking at the picture of your block diagram, it won't be so simple to introduce user events to your architecture. It would be easier to simply synchronise the start of your producer loops. Perhaps ntroduce a step between your hardware initialisation and the producer loops.
BTW, I think there might be a race condition in your Image capture code. You share a reference to the IMAQ image through a queue, but use the same reference for all your image captures. If the Write PNG does not occur before the next image capture than you'll lose the previous image. Think of the Image datatype as a reference, not data.
08-03-2016 03:07 PM
Hey Thoric,
Thanks for your help, but i'm having quite difficulty.
I tried to bundle all the queues from Producer/Consumer loops into one queue. It kinda works.
But I'm still having problems, and I think is about that race condition you told about. But I can't figure out how to fix it, could you tell me a more direct instruction? I already tried putting the IMAQ Create inside the loop but it didn't work. And tried linking the error ends of the IMAQdx Grab, with no results.
The error keeps repeating sistematically on the IMAQdx Grab, with a green arrow that freezes the screen.
I am sending the new logic on the VI below, tell me if you think that's the way to go.
Please, please. Help me one more time
Thanks in advance,
Oscar
08-03-2016 03:47 PM
This is the green arrow that shows in highlight mode after the program freezes.
08-04-2016 01:17 AM
I feel there are lot of things are not configured correctly. Let's go one by one
-You are using two cameras. How these cameras are triggered?
-The Grab fucntion is set to wait for next buffer mode, read the help then you will get why it is waiting.
-Do you want to grab images from both cameras same time or one after another?
-Like closing queue, you should be using dispose image after your writing finishes after consumer loop other wise you might loose that.
-Why are you using IMAQ write to PNG with vision info instead of IMAQ write to PNG when there is no info you are adding to image?
08-04-2016 09:14 AM