LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it Best Practice to store an instrument list as variant attributes?

To keep a list of instruments and their data I am using attributes (as a one element queue) in a variant.  I am wondering if this is best practice.  Would you please comment and/or direct me to a document that would explain pros and cons of different methods?

 

I made the attached example to help understand what I am asking.  

 

Here is how I initialize the object. 

Mark_L_0-1610747068400.png

 

Getting data from the variant is just a Preview on the queue. 

 

One drawback to this method is the shift register (feedback node) requires the list vi to be non-reentrant.  This means that the VI must complete before any other code can use this VI.  Is there a better way?  Also, if there are large data sets (large arrays for example) in the object does that mean a huge amount of memory manipulation?  I would think there may be a better way to make the code faster.  

 

Mark | CLA
0 Kudos
Message 1 of 3
(889 Views)

My current "Instrument Registry" code uses a Map of DVRs of Instrument Objects.  Yes, this registry VI is nonreentrant, but are you really trying to lookup that many instruments at the exact same time?

 

Maps are new in LabVIEW 2019 and are so much easier to understand and the performance against the Variant Attributes matches at the worse.

 

A Single Element Queue is a really old way to do a DVR.  DVRs with In Place Element Structures are great for ensuring only one place can communicate with an instrument at a time.

 

It looks like you already have the OOP figured out, so I'll leave that part alone.


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 2 of 3
(856 Views)

I have a bank of cameras that I am using that capture images all at the same time.  These image files can have large amounts of data. Unfortunately this also requires an image processing dll which means I have to send it large arrays.  Thus, I believe the answer is yes that I do have to look up many instruments all at the same time and the timing is critical.  

 

On the Instrument Registry do you know of a blog or example program?  I plan on making one myself to make sure I know how it works on the inside but it is always nice to double check if there are any gotchas that I may have missed.

 

 

Mark | CLA
0 Kudos
Message 3 of 3
(833 Views)