LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Spawning Multiple Sensor Threads programmatically?

Hi all,

 

In designing an acquisition system, I'm running up against a design problem; I am trying to abstract the notion of a sensor via LabVIEW OOP, but the acquisition aspect still confuses me. The way I would traditionally do it is, given some number of sensors, put down a While Loop for each sensor and use a queue or a User Event to indicate an acquisition to the main loop, where it is processed accordingly. But if, say, you don't know how many sensors are going to be used at build time, how would you accomplish this? Using Property Nodes and VI References, perhaps? If so, how does one open a VI reference to different instances of the same class VI?

 

On that note, if you have two instances of the same Sensor subclass (lets say you're using two temperature sensors from the same company), will you face problems of reentrancy? Or does each instance of the sensor class have its own separate reentrant behavior?

0 Kudos
Message 1 of 5
(3,064 Views)

The reentrancy is based on whatever VI properties you set.  I suggest you have a good long look at the Actor Framework.  It was designed for situations like this.


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 2 of 5
(3,057 Views)

Will having the Actor Framework change how I need to design my system? Or will it just add features on top of the procedural/OOP codebase I have?

0 Kudos
Message 3 of 5
(3,054 Views)

It will likely change everything on you.  Some argue for the better.  I personally have not yet dove into the full usage of the Actor Framework.  I do follow much of the ideas behind it, such as parallel processes that each do their own little thing.

 

As far as dynamically calling the same thing N number of times (where N is not known until runtime), I do something like this.  This code is put inside of a FOR loop that runs N times, each iteration spawning off another clone by creating a reference to the clone and then using the Asynchronous Call By Reference to run it.  In this case, I passed in a number so each station knew which data was for them.


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 4 of 5
(3,016 Views)

How do you keep track of which of the N is which? Is there some VI reference property that shows all the running VIs and their front panels/IDs?

0 Kudos
Message 5 of 5
(2,987 Views)