LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW "Enqueue Element.vi": one element 2 times enqueued

Hi

I've got a problem with "Enqueue Element.vi".

My program is writing strings to queue in first while-loop and reading these strings from the queue in second while-loop.

The problemm is, almost each new element will be writen in the queue two times and therefore there are almost two times more strings in the second while loop.

In case of "highlight execution" (the yelow lamp on) it works very well. In normal execution it works wrong, though the new string comms only one time per second to queue.

 

Thank you in advance!

 

Dimitri Karch

0 Kudos
Message 1 of 7
(3,428 Views)

If something works with highlight execution, but doesn't work in normal execution, that is usually a sign of a race condition.

 

It is difficult to give you any more advice unless you post your VI so we can take a look at it.Smiley Wink

0 Kudos
Message 2 of 7
(3,426 Views)
I wouldn't mind taking a look at it either if you want to post it.
0 Kudos
Message 3 of 7
(3,420 Views)

Thank you for response 🙂

My program is quite large... It should receive a UDP-Message at Ethernet-Network Intrface, analyse it and then send further through other two network interfaces.

 

0 Kudos
Message 4 of 7
(3,398 Views)

It's a little too large for me to understand quite yet.

 

But here are two tips.

 

1.  Why do you have a while loop in the lower center running 10 times/second that reads from a terminal and writes to a local variable of that terminal?  You are just writing a value back to itself.  It is like saying x=x in a text based language.  It could also be the source of your race conditions.  If you are writing a value to the same local variable elsewhere, it could be competing with this bit of code which would be writing stale information into it.  You can get rid of that entire while loop.  Use the free terminals in place of a local variable elsewhere in the code.  As it is, there are too many local variables being used throughout the code, so any of them could be causing you problems with race condtions.

 

2.  You can consolidate your initialization frame.  The Index Array function is expandable by dragging down the bottom border.  Instead of indexing 1, then 2 , then 3.  Use one index array structure.  Write a 1 to the index.  Drag down the border, you will have multiple outputs that will be 1, 2, 3, 4, .... in order.

 

Message Edited by Ravens Fan on 11-18-2008 12:23 PM
0 Kudos
Message 5 of 7
(3,394 Views)

Oh, the second tip is real great for me! I didn't know that trick. Thank you!

With lower central while-loop, you are right - was my mistake. I've remove it.

Unfortunately the bug is still here. I'l try to check the local variables.

0 Kudos
Message 6 of 7
(3,375 Views)

I'm sorry! The queue isn't the reason of the bug.

 

It's somthing wrong with UDP-receiving. I've minimized my receiver-program and also attached the sender compatible to it.

You would maybe take a look at it. I just cannot understand what's wrong!

 

Thank you in advance!

 

Dimitri

Download All
0 Kudos
Message 7 of 7
(3,355 Views)