06-07-2016 03:21 PM
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?
06-07-2016 03:32 PM
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.
06-07-2016 03:35 PM
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?
06-07-2016 08:29 PM - edited 06-07-2016 08:29 PM
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.
06-08-2016 09:36 AM
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?