LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop synch problem

Hi!


I'm working on a real time app running on MyRio, there is an image processing part and some other parts dealing with reading the digital and analog inputs.

 

In the attached picture you can see, that first I initialize some data from file, then more VI-s are running parallel, each one of them has a while loop inside.
In some VI-s I'm making mesurements and photos, in others I'm reading and processing them.

 

The problem must appear when I wanna process data which wasn't created earlier, so I need somehow to synchronize the loops at the beginning and probably in every cycle as well.
The fact that if I start the measuring VI with heighlight execution the whole thing runs without any problem also confirms the theory that I have the problem somehow with the simultaniously working loops.

Currently I'm using a notifier to trasfer the measured sensor data from one VI to another.


My question would be which synchronising tool (rendezvous, notifier...) fits the most my architecture and how should I impement it. Any tutorial or related topic's link would be helpful, unfortunately I didn't find any yet.

 

Thank you in advance!

Bye,
gazsi3

0 Kudos
Message 1 of 4
(3,289 Views)

Hello gazsi3,

 

you can use queues with a producer consumer architecture then only when data will be written into the queue the consumer will be executed, then the loops are synchronised. The next think is with notifier you can lost data with queues you have a fifo behind so if the consumer runs fast enough no data will be lost.

 

Be carefull if the consumer has more then one queue inside that deliver the data they can block each other, if the producers run on different rates.

 

Hope it helps

best regards
Alexander
0 Kudos
Message 2 of 4
(3,251 Views)

Interestingly I don't need all the data produced by the digital and analog input reading VI. I tought it would be easyer to constantli acquire data from the inputs, and only use the last one, when necesarry, than telling the data aquisition VI when to measure and when to be idle.
Meanwhile it apears that the cause of the problem is not really of fully the syncronisation, but another issue detailed in this topic: 

http://forums.ni.com/t5/LabVIEW/VI-Stop-shared-variable-vs-notification/td-p/3333352

0 Kudos
Message 3 of 4
(3,230 Views)

Hello gazsi3,

 

thanks for the feedback, additionally in the consumer loop you need no timing the loop is event driven from the notification.

Simple.png

 

best regards
Alexander
0 Kudos
Message 4 of 4
(3,196 Views)