LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check if named timed loop exists + wakeup reason

Hello

Is there a way to check what named structures are running in the system? For debugging reasons this would be convenient - I wouldn't need to create additional code to check whether my loops are running. One way to archieve that is to try to start loop and check if there is error. This is not a good solution in two ways - firstly, I have to create a table with all possible loops names in my system. Secondly, for a brief moment I start the loop in my "checker" VI, so it cannot be started where it is actually needed.

 

 

My second question is the meaning of "Wakeup reason" data node. Documentation says: "Returns an enumerated type with the reason for the execution start of the current iteration. The possible values are 0 for Normal, 1 for Aborted, 2 for Asynchronous wakeup, 3 for a Timing source error, 4 for a Timed loop error, and 5 for Timeout.". This is great, but I can't find any explanations of those values. I think I understand 0, 1, 2 and 3, but I'm unsure when Timed loop error and Timeout occurs.

 

0 Kudos
Message 1 of 6
(2,663 Views)

Brainstorming: If you put each loop as a sub-vi you can use vi-ref to get running status. It should work, but i'm not sure, i've never done it. 🙂

/Y

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

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

Ok Yamaeda, here's the twist: the VI containing timed loops is reentrant and runned using asynchronous call. I keep track of the running instances, but what I need is to check what loops are currently running, just for debugging purposes. To make something like "LV taks manager" 😉 LabVIEW prevents multiple loops with the same name from running simultaneously, so it has to all of them by name. There just might be property or invoke node that I'm not aware of?

0 Kudos
Message 3 of 6
(2,626 Views)

Dear PiDi!

 

A LabVIEW task manager that views all running VIs already exists, courtesy of the LAVAG Community. You can find it here.

 

I also have an additional idea if you want to observe loops specifically. You could create a an FGV that is callable from inside all your loops (timed or otherwise). With every loop name that you register, there's a timer associated. You periodically decrement these timers, and if a timer reaches zero, you remove the name from the list. If a loop runs, it calls the VI and refreshes the timer associated with it.

 

I've quickly whipped up some example code ofr this FGV, please tell me what you think.

 

Best regards:

 

Andrew Valko

NI Hungary

 

 

Andrew Valko
National Instruments Hungary
0 Kudos
Message 4 of 6
(2,618 Views)

Thanks, Andrew. FGV is one possible solution of course 😉 But this way I still need to write my own code and manage "debug"/"production" code. As I said, my reasoning was: if LV knows internally every running loop by name, there might be a way to obtain that knowledge. If there is no way, its ok, I can do it on my own.

 

My second question about wakeup reason is still untouched though, so there are still some kudos on the table 😄

0 Kudos
Message 5 of 6
(2,602 Views)

Dear PiDi!

 

The Wakeup Reasons can be as follows:

 

Normal -If the loop is being called as normally scheduled 
Aborted - Called if the timed loop is stopped externally
Timing source error -There is an error with the timing source selected for the timed loop 
Timed loop error - An error in the timed loop structure itself 
Timeout - Occurs if the amount of time specified in the timeout occurs before the loop begins execution

 

Please tell me if something is still left unexplained or unclear. About the loop run check, I'm unaware of any option to access this information, but I'll soop around a bit to see if I can dig up something.

 

Kind regards:

 

Andrew Valko

AE Hungary

Andrew Valko
National Instruments Hungary
Message 6 of 6
(2,588 Views)