LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event case execution order

I have an event case that handles something according to values of a cluster. The case is invoked by values change and a property node (value Signalling). This works well. However I want to invoke it every time a value(sgnl) is done (see picture). I want the event be invoked after the first value(sgnl) and a second time after the second val(sgnl). How can I tell the program to do so?

Currently only the second val(sgnl) is triggering the event.

0 Kudos
Message 1 of 8
(564 Views)

Hello Robert,

 

I see neither first nor second Value(Sgnl) nodes.

The two nodes can execute either in an order or in the other.

 

To force "all Tests" to execute first, you should wire error between the nodes.

 

Think Dataflow.

0 Kudos
Message 2 of 8
(553 Views)

I see 2 major issues here.

1. You have a race condition since you have nothing to state which property node will execute first.  Whichever property node executes first will dictate which event will be called first because the Event Structure uses a queue (FIFO) behind the scenes.

2. Your two events will be sent so quickly, it is likely you (as a person) just won't see it being handled since the next one is immediately being called.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(549 Views)

To enforce an excution order, take the errour out from the first property node and wire it to the error in terminal of the second.

Both events will be executed in any case.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 8
(534 Views)

as has been mentioned, you have a glaring race conditions easily solved by an error wire to determine which event gets enqueued first.

 

Of course (without seeing the rest of the code), you seem to be abusing an event structure for program execution. Events are primarily meant for user interactions and there is a significant probability that whatever you are trying to do could be done better without events.

 

What is the overall program architecture? I assume the evet structure is in a while loop, is always ready to fire, and event cases don't have interactive code, right? Maybe if you would show us the rest of your code, we could give more specific advice.

0 Kudos
Message 5 of 8
(508 Views)

Hi all

Thanks for your replies. The Error wire doesn't help. Maybe the the timing too fast (although I set a wait between). Anyway, I changed it to do without envent structure.

0 Kudos
Message 6 of 8
(466 Views)

Do you remember the Laws of Data Flow?  There are two calls to TestSelectAppearance's Value Signal Event, but the order cannot be determined.  If you connected the Error Line from the output of the first to the input of the second, then the "first would be first".  It would be even clearer if you put a "Stall" VIM on the Error Line and set a 1 ms delay between the two.  By calling them "simultaneously", something appears to get lost, so make them sequential.

 

Bob Schor

0 Kudos
Message 7 of 8
(448 Views)

Robert@KMI wrote:

Hi all

Thanks for your replies. The Error wire doesn't help. Maybe the the timing too fast (although I set a wait between). Anyway, I changed it to do without envent structure.


There is no "maybe" in programming but we cannot debug from a truncated picture. We can't even tell if you are testing this correctly. How long does each event take to complete?

 

Bildschirmfoto%202024-06-20%20um%2014.24.01

 

There is another possibility:

 

  • IF the event is currently executing
  • AND you queue up two events in rapid succession
  • AND the event queue is set to limit the event queue to one instance (NOT the default!)
  • Then one of the two events will get discarded. With the pictured code we cannot tell which one, but once you sequence them with an error wired, only the last one will survive.

 

We can tell from the picture that your overall architecture might be questionable. If you would show us the rest of the code, we can probably give hints to improve it by orders of magnitude (performance, readability, scalability, etc.). 😄

(For example it is not clear why you don't use a cluster diagram constant, why your enums are not typedefs or why you think you  need a sequence structure. etc etc.)

0 Kudos
Message 8 of 8
(428 Views)