LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ring strange behaviour happens very rarely

In my VI I have two different while loop running independantly. In first while loop when user selects any item from ring then accordingly I will update other two indicator(max and min) which is as per item selected from ring

 

In the other while loop I will keep monitoring the two indicator and write to database after serial number scanned. Very rarely and occasionaly it happens that when user scanns  the serial number then it assigns 0th item of ring and also max and min to scanned serial number.

 

In short if in my ring 5 items namely A B C D E are there, eventhough after scaning serial nunber it changes to A.

 

Attached VI for reference

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 1 of 16
(2,707 Views)

You have a race condition between the Model control and it's Value property node.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 16
(2,682 Views)

How it can be?

 

And it also happens very rarely...Once or twice in a month.

 

Can you please elobrate 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 16
(2,676 Views)

You should also put your init stuff in a sequence structure and run the error wire through it.  (Better yet, a state machine with an init state, but to keep things simple...)  Another race condition.  What's to stop the while loops from executing before your init stuff?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 16
(2,669 Views)

I cant use sequential as both can happen independently. How race condition? I am still not sure where and why its happening

 

In my application once user changes the model then after some time only he scan the serila number then why race condition

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 16
(2,667 Views)

@Ranjeet_Singh wrote:

I cant use sequential as both can happen independently. How race condition? I am still not sure where and why its happening

 

In my application once user changes the model then after some time only he scan the serila number then why race condition


User changes model, in the mean time the model property has already read the old value and is waiting for the serial number ... that's a race, you could fix it by wiring the error wire from the serial number read to the model property, that way it'll always be read after the serial number, not before.

I'd change it to an event structure, model change event and serial number change event, it'd make things safer and better.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 16
(2,648 Views)

Editor tossed in some odd stuff see below


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 16
(2,635 Views)

@Ranjeet_Singh wrote:

I cant use sequential as both can happen independently. How race condition? I am still not sure where and why its happening

 

In my application once user changes the model then after some time only he scan the serila number then why race condition


Lets try to explain with pictures:

Capture.PNG

Read the value of Model read Change the value and select max and min Then do some lengthy Database operation and write the stale value back to model and get the stale values text.  

Th solution is fairly straight forward  Do not write to the value property at 4 Instead, read the rings Strings[] property and index by the old value  to get the ring text that was displayed when the operation began.  Alternatly read ringtext.text at the begining of the long operation for later use. 

 

You are doing a lot of dangerous stuff waiting until the operation is complete to gather the logfile information (and abuing locals and p-nodes for no good reason.  A more standardized design pattern selection would make that type of bug easier to find if it didn't prevent you writting it in the first placeSmiley Wink

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 16
(2,629 Views)

What happened, Ranjeet?  You had started out with so much potential.  😞

 

I don't mean this disparagingly.  It's kind of like losing Anikan to the Dark Side...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 16
(2,598 Views)

Hey, Ranjeet:

 

Some poeple let me know that my post sounded really mean, when actually I was trying to express how bad I felt for you that you were struggling for so long.  Please accept my apolgoy.  I didn't mean to be mean at all.  😞

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 16
(2,586 Views)