06-20-2024 07:38 AM
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.
06-20-2024 07:53 AM
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.
06-20-2024 07:56 AM
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.
06-20-2024 08:08 AM
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.
06-20-2024 08:54 AM
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.
06-20-2024 11:47 PM
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.
06-21-2024 07:09 AM
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
06-21-2024 09:44 AM - edited 06-21-2024 09:45 AM
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?
There is another possibility:
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.)