LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queue problem!. Put the queue in mainscreen...

Hrmmm.  If you put the frequency display in the data aquisition loop, would it slow things down too much?  Because I feel that would be a better approach.  Aquire, display, and enqueue.  A third option would be to put the entire dataset in a single element queue.  Dequeue dataset, do stuff*, reenqueue dataset.  *stuff can be anything from adding more data to the array, to displaying the last data added, to displaying ALL the data.

Live updates to the graph require the graph to be inside the while loop.  There are several methods for accomplishing this depending on how many data points you expect.
Message 11 of 16
(1,295 Views)

See the attached vi. I got read at the same time, but it is disordered. Can you say me why?.

Regards.

Download All
0 Kudos
Message 12 of 16
(1,293 Views)
You have done an amazing thing.  You have created a race condition with a queue. Robot surprised  I did not think it could be done.  Normally, queues are filled once per loop iteration.  In your case, three data are entered per loop iteration.  Since queue.vi's loops are parallel, you can have some odd behaviours.

You expect
Producer writes 1 2 3, 1 2 3, 1 2 3 ...
Consumer reades 1 2 3, 1 2 3, 1 2 3 ...
The queue has 1 2 3 1 2 3 1 2 3 ...

But, what happens if Cosumer starts to read before Producer has put anything in?
Producer writes: 1 2 3, 1 2 3, 1 2 3 ...
Consumer reads _ 1 2, 3 1 2, 3 1 2 ...
The queue has 3 1 2 3 1 2 3 1 2 ...

When you try to read the queue in main-2, you are reading from an odd spot in the queue.  I am going to suggest that you rewrite to pass either clusters or arrays to the queue instead of individual elements.
Message 13 of 16
(1,269 Views)

Hi Jason,

I tested like you told me, and well it is running. But i have one problem. In main vi, i have the dequeue inside of case structure, therefore i can't use the data to stuff with anothers calculates and show in graph. Any possibility to read outside of case structure??. I would like real inside of while loop, maybe with anothers Dequeue, but i didnt got it.

Any advise to get it?.

Regards.

Download All
0 Kudos
Message 14 of 16
(1,250 Views)
Hi Fonsi,

I am having a very hard time understanding what you are trying to do. Robot Sad I am not certain, but you may be making your program more complicated than it needs to be.

I think a deeper understanding of LabVIEW and dataflow in particular would help a lot.  National Instruments offers two excellent (and free!) tutorials online.  One is three hours, the other is six hours.

=jason
Message 15 of 16
(1,238 Views)
Hi Jason,
 
I think it is easy. I am using main panel where is showed the graph. In one moment i want to do any test, I push bottom acquisition data, this subvi take the system to read from serial port (see the capture, the other capture is the main with the subvi ), This sub vi get the figures from serial port and in little screen show the rpm with dials, not very difficult or big work in this subvi. Then, right now, One time i push stop acquisition or stop to send, directly all the data travel to the main vi and is showed in graph. Well, right now all work perfectly.
In this improvement, I want in the same time the little screen is showing the rpm and others dials, send the data to main vi to going to draw the figures on graph in real time, Do you get me now??. Sorry for my english I am Spanish guy, its not good :).
 
Thats why in subvi i use 2 while loops, The first to get the data from serial port and the second to get the flow data to show the rpm and others dials, thats why i use the queue to get in the same time the data. But i dont know how get the data travel in the same time to main vi. In main vi I only have several formulates and others subvis.
 
Now better?.
Regards.
Download All
0 Kudos
Message 16 of 16
(1,234 Views)