LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple reentrant clones with not reentrant FGV timer

Solved!
Go to solution

Hi,
I want to create some timer launcher. So I created simple timer based on functional global variable and I tried to launch multiple clones of it in reentrant "timer launcher". The thing is that timer is not reentrant (every FGV that i saw was not reentrant) and I don't know how to create such a launcher.


Attached picture illustrate the idea. So I'm launching clone1 (which is some reentrant VI), in that clone I have not reentrant timer but it is not reentrant from the clone 1 perspective only. In clone 2 i have another timer which is not reentrant from clone 2 perspective but reentrant from clone 1 perspective and so on. It is quite complicated to describe but i hope picture demonstrate my problem somehow.

 

Please help

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 1 of 12
(6,027 Views)
Solution
Accepted by topic author bienieck

You can do this if you make your timer preallocate-clones-reentrant, and then call it by reference (one reference in each clone of the timer launcher so that each launcher is using a separate timer clone).

Message 2 of 12
(6,005 Views)

Thanks drjdpowell, it works. I've attached my solution.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 3 of 12
(5,953 Views)

You don't necessarily need the Open VI ref stuff.  You can just have two static references (which will preallocate two clones) and wire them directly in to the Call by Ref nodes.

0 Kudos
Message 4 of 12
(5,940 Views)

Ok, but I will open different number of clones in practice, so static refs is not the best idea, in my understanding.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 5 of 12
(5,937 Views)

Another method I have used in the past is to store the timer information in a named queue (e.g. name your timers). This is a much simpler method for calling/creating timers - you call the same VI each time (or you can make it reentrant to speed execution but you get the data for the timer from a queue (Single Element Queue, SEQ). It's a common method for having multiple instances of an FGV. You could also store the data in a DVR and pass the DVR references around.

 

What you've got there will work but it seemed a bit overkill to me unless it was an exercise in asynchronous calling etc.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 12
(5,924 Views)

@Sam_Sharp wrote:

Another method I have used in the past is to store the timer information in a named queue (e.g. name your timers). This is a much simpler method for calling/creating timers - you call the same VI each time (or you can make it reentrant to speed execution but you get the data for the timer from a queue (Single Element Queue, SEQ). It's a common method for having multiple instances of an FGV. You could also store the data in a DVR and pass the DVR references around.


If you are using the SEQ, please change over to the DVR.  This was the exact case the DVR was meant to replace.

 

And instead of named queues, use a Variant and use the Variant Attributes to store your times.  The lookup is really fast and uses names.  Very useful function.

 

Personally, I would probably store a DVR of type variant in a global variable.  The In Place Element Structure will take care of all of the race conditions.


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
Message 7 of 12
(5,913 Views)

Yes, I do almost exclusively use DVRs and variant attributes for this sort of problem but I was trying to think of a method that meant you didn't have to pass the references around and a named queue was what immediately sprung to mind but now that I think about it there's zero benefit in doing so.

 

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 12
(5,909 Views)

Can I ask for some snippet or other visual description of that solution? Or, if it is some standard approach, for some link with more info?

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 9 of 12
(5,861 Views)

Sure....

 

(error handling required)

 

DVR Lookup.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 10 of 12
(5,855 Views)