From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Events in Event Structure timeout

Solved!
Go to solution

I have two heartbearts signals (booleans which flip from True to False to True at regular intervals) indicating the health of two parallel loops. I want to make to sure that each of these loops is executing at a reasonable speed and are not hung up on anything. The easiest solution I can think of is an event structure looking at Value changes for each heartbeat with a Timeout case.

 

However, I cannot figured out how to combine events as AND instead of OR. Currently, if one heartbeat is slowing down, the event structure still executes if the other loop is working. In short, I want the event structure to trigger only if both events occured before the timeout.

0 Kudos
Message 1 of 23
(3,328 Views)

Put timestamps of when each value change occurs into a shift register running through the event structure.  If you find that the timestamp of the one is much older than the timestamp that just occurred, you can assume that the one has stopped updating.

 

Instead of using an event structure, you could also look at notifiers, one from each loop.  Wait on notification has a timeout that you can use.

0 Kudos
Message 2 of 23
(3,322 Views)

Notifiers seem to be exactly what I'm looking for. Is there a way to use Wait on Notification from Multiple such that it waits for new notifications from all notifiers instead of waiting for the first notifaction in the array? Otherwise, I need to have lots of Wait on Notification functions (as many as I have loops).

0 Kudos
Message 3 of 23
(3,309 Views)

Wait on Multiple Notificatiers will work.  You still need to create mutipler notifiers, but bundle them into an array and only have the single Wait happening in your one loop.

0 Kudos
Message 4 of 23
(3,302 Views)

From the documentation: "Waits until at least one of the notifiers you specify receives a message." I want it to wait until all of the notifiers receive a message.

0 Kudos
Message 5 of 23
(3,292 Views)

Look for the Rendezvous (just next to Notifiers in Synchronization pallete). I think they have just the functionality you need.

0 Kudos
Message 6 of 23
(3,284 Views)

You're right, that won't work.  I was going by the title, and not what the help actually set.

 

You could create your own Wait for ALL Notifications.  Send an array of all the notifier references into a subVI.  Create as many Waits as you need there with timeouts.  It isn't directly scalable.  Basically just doing what you'd have to do in the one loop anyway to handle the multipe notifiers, but packaging it into its own subVI to save BD space.

0 Kudos
Message 7 of 23
(3,281 Views)

Look at the example for Wait on Multiple Notifiers.  If the wait is long enough in the main loop, it will process both notifiers.  If only one is processed, there is a delay in one of your heart beats. 

 

I don't think rendezvous will work because you can't pass data with it....only the size of the rendezvous.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 23
(3,275 Views)

!1.png

It hides in the advanced waiting sub-palatte but its there

Now you need only use a timestamp as the notifier type  if you timeout both heartbeats failed, if they get too far apart one heartbeat died.


"Should be" isn't "Is" -Jay
Message 9 of 23
(3,265 Views)

aputman wrote:

I don't think rendezvous will work because you can't pass data with it....only the size of the rendezvous.


Yeah, it won't work, just ignore my previous post, I'm tired 😛 However, it won't work because it would lock the threads on 

Wait at Rendezvous, which is not good here. The fact that it does not contain any data is not a problem here - the hearbeat signal itself does not necessary contain any data, it just some kind of event fired periodically.

 

@maritan, do you really need to check if both loops are executed in synchronized fashion? Wouldn't just checking each loop heartbeat period independently be enough?

0 Kudos
Message 10 of 23
(3,257 Views)